一、前言

  自从换了新环境,各种问题层出不穷,如果不是之前积累的经验丰富,估计都歇菜了,看来作为数据库全栈工程师(oracle/mysql/sqlserver/sap hana/pg/mongodb/redis)还是有好处的(新环境需要完善的地方很多很多啊...),O(∩_∩)O哈哈~。今天同事找我说有个报表库4.5号数据就没有了,问我是不是ogg数据同步有问题。我一脸懵逼,首先4.5号出现的问题,现在都快1个月了才发现说明监控机制不完善,其次业务部门这反映也太滞后了也,出问题就先解决问题呗。

二、问题排查

登录Ogg源库查看相关进程:

[oracle@dg dirprm]$ ../ggsci

GGSCI (dg) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT RUNNING DPRPT01 00:00:00 666:57:30
EXTRACT ABENDED EXTRPT01 00:00:00 666:57:38
GGSCI (dg) 2> info EXTRPT01

EXTRACT    EXTRPT01  Last Started 2017-10-27 18:12   Status ABENDED
Checkpoint Lag 00:00:00 (updated 666:58:56 ago)
Log Read Checkpoint Oracle Redo Logs
2018-04-05 23:00:24 Seqno 282927, RBA 832138240
SCN 12.2143954677 (53683562229)

通过上面检查,发现源端的数据抽取进程已经挂起27天左右了,也就是发生在4.5号的23:00,那么具体是什么原因导致的这个问题呢?需要通过检查ogg错误日志

[oracle@dg ogg]$ cd dirrpt/

[oracle@dg dirrpt]$ vi DPRPT010.rpt

2018-04-05 23:00:36  ERROR   OGG-01098  Could not flush "./dirdat/e1000004383" (error 28, No space left on device).
Failed to save data to 'dirdmp/gglog-EXTRPT01.dmp', error 28 - No space left on device

发现具体导致进程挂起的原因是因为磁盘空间不足,导致数据抽取无法写入trail文件,检查磁盘空间发现磁盘目前是充足的,那么尝试重启ext进程

GGSCI (dg) 1>start EXTRPT01
Sending START request to MANAGER ...
EXTRACT EXTRPT01 starting GGSCI (dg) 3> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING
EXTRACT RUNNING DPRPT01 00:00:00 667:04:13
EXTRACT RUNNING EXTRPT01 00:00:00 667:04:21 隔1分钟后 GGSCI (dg) 4> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING
EXTRACT RUNNING DPRPT01 00:00:00 667:05:10
EXTRACT ABENDED EXTRPT01 00:00:00 667:05:17

启动失败,再次查看错误日志DPRPT01.rpt,错误信息如下:

2018-05-03 11:36:52  ERROR   OGG-00446  Could not find archived log for sequence 282927 thread 1 under default destinations SQL <SELECT  name    FROM v$archived_log   WHERE sequence# = :ora_seq_no AND         thread# = :ora_thread AND         resetlogs_id = :ora_resetlog_id AND         archived = 'YES' AND         deleted = 'NO' >, error retrieving redo file name for sequence 282927, archived = 1, use_alternate = 0Not able to establish initial position for sequence 282927, rba 790067728.

2018-05-03 11:36:52  ERROR   OGG-01668  PROCESS ABENDING.

这里可以看到抽取进程读取源库的归档日志的时候无法找到相应归档日志(估计已被清理)

col name for a55;
set line 200;
set pagesize 20000; select sequence#,name,COMPLETION_TIME,STATUS from v$archived_log where sequence#>=282926 and rownum<=30;

经过确认,发现确实自282927以后到5.2日前的归档日志已经被删除,至此可以确认问题导致的原因和现状情况。

错误原因是:磁盘空间不足导致抽取进程挂起,然后隔了好久没有恢复OGG数据同步,数据源的归档日志又被清理掉,所以无法通过启动抽取进程完成恢复OGG数据同步。

三、解决方案

1、可以通过从备份恢复归档日志,完成ogg数据同步直接。(鉴于每天归档日志大约80G左右,一个月的归档数据恢复较大量以及数据同步依旧需要较大数据量,所以不采用此方式)

2、通过重新部署OGG主从同步进程,完成OGG数据同步,经过检查发现需要同步的表有11张,数据量最大的也就6千万左右数据,同步速度比较快。

select count(1) from   testuser.t_t1; --
select count(1) from testuser.t_t2; --
select count(1) from testuser.t_t3; --
select count(1) from testuser.t_t4; --
select count(1) from testuser.t_t5; --
select count(1) from testuser.t_t6; --
select count(1) from testuser.t_t7; --
select count(1) from testuser.t_t8; --
select count(1) from testuser.t_t9 --
select count(1) from testuser.t_t10; --
select count(1) from testuser.t_t11; --

3、完成数据同步恢复后,需要完善数据库状态监控,包含不仅限于DG主备装填、OGG进程状态、实例状态等

4、重新部署过程略。

1、停止源库和目标库ogg进程
1)源库 GGSCI (source_userdg) 7> stop extrpt01
EXTRACT EXTRPT01 is already stopped. GGSCI (source_userdg) 9> stop DPRPT01 Sending STOP request to EXTRACT DPRPT01 ...
STOP request pending end-of-transaction (4 records so far).. GGSCI (source_userdg) 24> kill extract DPRPT01 Sending KILL request to MANAGER ...
Killed process (19665) for EXTRACT DPRPT01 2)目标库 GGSCI (source_user_report) 2> stop REPRPT01
REPLICAT REPRPT01 is already stopped. 2、删除原配置文件
1)源库
GGSCI (source_userdg) 26> delete EXTRPT01 2018-05-07 10:16:39 WARNING OGG-01753 Cannot unregister EXTRACT EXTRPT01 from database because no database login was provided. You can manually unregister this group later with the UNREGISTER EXTRACT command with LOGRETENTION. Issue DBLOGIN first.
Deleted EXTRACT EXTRPT01. GGSCI (source_userdg) 27> delete DPRPT01
Deleted EXTRACT DPRPT01. 2)目标库
GGSCI (source_user_report) 5> delete REPRPT01
ERROR: Could not delete DB checkpoint for REPLICAT REPRPT01 (Database login required to delete database checkpoint) GGSCI (source_user_report) 6> dblogin useridalias gguser
Successfully logged into database. GGSCI (source_user_report as gguser@source_dbname) 7> delete REPRPT01
Deleted REPLICAT REPRPT01. 3、清理日志和历史文件
1)源库
[oracle@source_userdg ogg]$ rm -rf dirdat/*
[oracle@source_userdg ogg]$ rm -rf dirrpt/EXT*
[oracle@source_userdg ogg]$ rm -rf dirrpt/PUMP*
[oracle@source_userdg ogg]$ rm -rf dirrpt/ext01*
[oracle@source_userdg ogg]$ rm -rf dirrpt/DPR*
[oracle@source_userdg ogg]$ rm -rf dirrpt/extrpt01.dsc
[oracle@source_userdg ogg]$ rm -rf dirrpt/MGR{0,1,2}*
2)目标库
[oracle@source_user_report ogg]$ rm -rf dirdat/r1000004383
[oracle@source_user_report ogg]$ rm -rf dirrpt/REPRPT01*
[oracle@source_user_report ogg]$ rm -rf dirrpt/rep*
[oracle@source_user_report ogg]$ rm -rf dirrpt/MGR0.rpt
3)目标库表数据清理 alter session set current_schema=gguser; truncate table xxx; 4、重新配置 1)源库
extract进程配置
GGSCI (source_userdg as gguser@source_user) 4> add extract extrpt01,tranlog,begin now
EXTRACT added. GGSCI (source_userdg as gguser@source_user) 5> add exttrail ./dirdat/ex,extract extrpt01 MEGABYTES 100
EXTTRAIL added. pump进程配置
GGSCI (source_userdg as gguser@source_user) 6> add extract DPRPT01,exttrailsource ./dirdat/ex
EXTRACT added. GGSCI (source_userdg as gguser@source_user) 7> add rmttrail ./dirdat/rt,extract DPRPT01
RMTTRAIL added. 2)目标库 GGSCI (source_user_report) 1> dblogin useridalias gguser
Successfully logged into database.
GGSCI (source_user_report as gguser@source_dbname) 3> add checkpointtable gguser.checkpointtab Successfully created checkpoint table gguser.checkpointtab. GGSCI (source_user_report as gguser@source_dbname) 4> add replicat REPRPT01,exttrail ./dirdat/rt,checkpointtable gguser.checkpointtab
REPLICAT added. 3)启动源库进程
GGSCI (source_userdg) 6> start EXTRPT01 Sending START request to MANAGER ...
EXTRACT EXTRPT01 starting GGSCI (source_userdg) 7> start DPRPT01 Sending START request to MANAGER ...
EXTRACT DPRPT01 starting GGSCI (source_userdg) 8> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING
EXTRACT RUNNING DPRPT01 00:00:00 00:00:47
EXTRACT RUNNING EXTRPT01 00:00:53 00:00:03 4)源库数据导出 select * from dba_directories;
DATA_PUMP_DIR
/U01/oracle/admin/source_user/dpdump/ col CURRENT_SCN format 999999999999999999999999;
set line 200;
set pagesize 20000; select current_scn from v$database;
55011413592
##select dbms_flashback.get_system_change_number current_scn from dual;
##select timestamp_to_scn(to_timestamp('2018-05-06 08:05:14')) from dual;
##select to_char(scn_to_timestamp(55011413592),'yyyy-mm-dd hh24:mi:ss') from dual; expdp \'/ as sysdba\' directory=DATA_PUMP_DIR file=20180507.dmp tables=source_user.t1,source_user.t2,source_user.t3 grants=n statistics=none triggers=n compress=n content=data_only FLASHBACK_SCN=55011413592 log=expdp.log 5)目标库数据导入
select * from dba_directories;
DATA_PUMP_DIR
/U01/oracle/admin/source_dbname/dpdump/
impdp \'/ as sysdba\' DIRECTORY=DATA_PUMP_DIR DUMPFILE=20180507.dmp REMAP_SCHEMA=source_user:gguser content=data_only LOGFILE=impdp.log 6)启动目标库进程
start REPRPT01,aftercsn 55011413592 GGSCI (source_user_report) 17> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING
REPLICAT RUNNING REPRPT01 02:43:08 00:00:04 5、数据校验

Oracle案例06—— OGG-01098 Could not flush "./dirdat/e1000004383" (error 28, No space left on device)的更多相关文章

  1. Oracle HA 之 OGG部署流水

    1.GG组件及其功能简介:    manager进程:总管其他所以进程及处理相应GGSCI命令.    capture进程:从源端的联机日志文件或归档日志文件抓取commit的信息.    sourc ...

  2. linux下单节点oracle数据库间ogg搭建

    环境说明:   linux为Linux 2.6.32-573.el6.x86_64     oracle为 11g Enterprise Edition Release 11.2.0.1.0 - 64 ...

  3. Oracle GoldenGate (以下简称ogg)在异种移植os同一种db之间的数据同步。

    Oracle GoldenGate (以下简称ogg)在异种移植os同一种db之间的数据同步. ogg要实现的功能: 同步可以细化到单个表,满足特定的where条件rows同步,称号column同步. ...

  4. ORA-19502: write error on file "/u01/app/oracle/oradata/standby/system01.dbf", blockno 40321 (blocksize=8192)【error收集】

    在RMAN备份中,出现了一个问题,就是出现坏块了. ORA-: write error on file (blocksize=) ORA-: File I/O error Linux Error: : ...

  5. Oracle 11g 测试ogg中断之后,重新同步操作

    测试ogg中断之后,重新同步操作 2018-06-07 17:11 779 1 原创 GoldenGate 本文链接:https://www.cndba.cn/leo1990/article/2839 ...

  6. 10.Oracle Golden Date(ogg)的搭建和管理

    一. GoldenGate 概述 GoldenGate现在是业内成熟的数据容灾与复制产品:GoldenGate是一种基于日志的结构化数据复制方式,它通过解析源数据库在线日志或归档日志获得数据的增删改变 ...

  7. Oracle案例13—— OGG-01163 Oracle GoldenGate Delivery for Oracle, reprpt01.prm

    由于虚拟机宿主机重启,导致很多虚拟机服务需要重点关注,其中一个DG的从库和另一个report库有OGG同步,所以这里再系统恢复后检查OGG状态的时候,果然目标端的REPLICAT进程处于abend状态 ...

  8. Oracle案例12——NBU Oracle恢复

    最近在做NBU ORACLE备份的恢复测试,执行恢复时报错ORA-27211: Failed to load Media Management Library,具体处理过程如下:一.错误信息 执行命令 ...

  9. Oracle案例11——Oracle表空间数据库文件收缩

    我们经常会遇到数据库磁盘空间爆满的问题,或由于归档日志突增.或由于数据文件过多.大导致磁盘使用紧俏.这里主要说的场景是磁盘空间本身很大,但表空间对应的数据文件初始化的时候就直接顶满了磁盘空间,导致经常 ...

随机推荐

  1. $bzoj1025-SCOI2009$游戏 群论 $dp$

    题面描述 \(windy​\)学会了一种游戏.对于\(1​\)到\(N​\)这\(N​\)个数字,都有唯一且不同的1到N的数字与之对应.最开始\(windy​\)把数字按顺序\(1,2,3,\cdot ...

  2. es xxx_by_query

    xxx_by_query包括_delete_by_query和_update_by_query,下面分开讲 _delete_by_query 相当于sql中的delete from a where . ...

  3. 实验Complex

    #include<iostream> #include<cmath> using namespace std; class Complex { public: Complex ...

  4. (转)linux exec与重定向

    原文:http://xstarcd.github.io/wiki/shell/exec_redirect.html linux exec与重定向 exec和source都属于bash内部命令(buil ...

  5. (转)nginx日志配置指令详解

    这篇文章主要介绍了nginx日志配置指令详解,nginx有一个非常灵活的日志记录模式,每个级别的配置可以有各自独立的访问日志,需要的朋友可以参考下日志对于统计排错来说非常有利的.本文总结了nginx日 ...

  6. selenium+Python(截图保存错误页面)

    异常捕捉与错误截图 创建错误截图文件夹,目录结果如下: 用例不可能每一次运行都成功,肯定运行时候有不成功的时候,关键是我们捕捉到错误,并以把并错误截图保存,这将是一个非常棒的功能,也会给我们错误定位带 ...

  7. Cloudera Manager安装之Cloudera Manager 5.6.X安装(tar方式、rpm方式和yum方式) (Ubuntu14.04) (三)

    见 Ubuntu14.04下完美安装cloudermanage多种方式(图文详解)(博主推荐) 欢迎大家,加入我的微信公众号:大数据躺过的坑     免费给分享       同时,大家可以关注我的个人 ...

  8. android TCP 和 UDP总结(转)

    之前写过一些关于TCP和UDP数据传输的代码,比如使用TCP传输音视频数据包,P2P打洞中使用UDP等.写好之后就直接丢下了,没有总结下都.最近准备找工作,再拿来温习下. 1.还是先说点啥 暂时把自己 ...

  9. Light Table 编辑器修改字体 更新

    view->command->use.behaviors 加上这一句  (:lt.objs.style/font-settings "Inconsolata" 14 1 ...

  10. WPF事件中的sender就是事件源

    可以看到wpf中所有的事件都是这个格式: private void btnTest_Click(object sender, RoutedEventArgs e)  { Button btn = (B ...