OGG 进程清除、重建
2024-07-21 02:52:55
供稿:网友
背景描述:有时候OGG进程同步出现问题,症状某些进程起不来,而且问题一时半会儿解决不了。最简单的办法是:用数据泵初始化数据,OGG进程重建。1.查看源端、目的端的进程状态。 (作者OGG进程是正常的,假设进程是 abend )源端:GGSCI (11g) 1> info allPRogram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING EXTRACT RUNNING DPEA 00:00:00 00:00:08 EXTRACT RUNNING EXTA 00:00:00 00:00:04 目的端:GGSCI (11g) 1> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING REPLICAT RUNNING REPA 00:00:00 00:00:07 2. 停止 源端、目的端 除 mgr 进程,以外的所有ogg进程。源端:GGSCI (11g) 2> stop extaSending STOP request to EXTRACT EXTA ...Request processed.GGSCI (11g) 3> stop dpeaSending STOP request to EXTRACT DPEA ...Request processed.目的端:GGSCI (11g) 2> stop repaSending STOP request to REPLICAT REPA ...Request processed.3. 检查源端、目的端 除 mgr 进程,以外的所有ogg进程的进程状态是否是 stop。 源端:GGSCI (11g) 4> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING EXTRACT STOPPED DPEA 00:00:00 00:01:54 EXTRACT STOPPED EXTA 00:00:00 00:02:07目的端:GGSCI (11g) 3> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING REPLICAT STOPPED REPA 00:00:00 00:01:324. 用OGG管理用户连上数据库,删掉除 mgr 进程,以外的所有ogg进程。源端:GGSCI (11g) 5> dblogin userid goldengate,passWord goldengateSuccessfully logged into database.GGSCI (11g) 6> delete extaDeleted EXTRACT EXTA.GGSCI (11g) 7> delete dpeaDeleted EXTRACT DPEA.目的端:GGSCI (11g) 4> dblogin userid goldengate,password goldengateSuccessfully logged into database.GGSCI (11g) 5> delete repaDeleted REPLICAT REPA.5. 检查ogg进程状态。源端:GGSCI (11g) 8> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING 目的端:GGSCI (11g) 6> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING 6. 清除参数 (注意删除文件的时候,不要多删其他无关进程文件)源端:[Oracle@11g ogg]$ cd dirprm[oracle@11g dirprm]$ pwd/home/oracle/ogg/dirprm[oracle@11g dirprm]$ lltotal 16-rw-rw-rw-. 1 oracle oinstall 193 Nov 9 07:54 dpea.prm-rw-rw-rw-. 1 oracle oinstall 206 Nov 9 07:53 exta.prm-rwxr-x---. 1 oracle oinstall 53 Apr 23 2012 jagent.prm-rw-rw-rw-. 1 oracle oinstall 10 Nov 9 03:52 mgr.prm[oracle@11g dirprm]$ rm -rf dpea.prm exta.prm目的端:[oracle@11g ogg]$ cd dirprm[oracle@11g dirprm]$ pwd/home/oracle/ogg/dirprm[oracle@11g dirprm]$ lltotal 12-rwxr-x---. 1 oracle oinstall 53 Apr 23 2012 jagent.prm-rw-rw-rw-. 1 oracle oinstall 10 Nov 9 03:53 mgr.prm-rw-rw-rw-. 1 oracle oinstall 301 Nov 9 07:55 repa.prm[oracle@11g dirprm]$ rm -rf repa.prm7.清除 Trails 文件 源端:[oracle@11g dirprm]$ cd ..[oracle@11g ogg]$ cd dirdat[oracle@11g dirdat]$ pwd/home/oracle/ogg/dirdat[oracle@11g dirdat]$ lltotal 20-rw-rw-rw-. 1 oracle oinstall 1023 Nov 9 06:57 la000000-rw-rw-rw-. 1 oracle oinstall 1336 Nov 9 07:55 la000001-rw-rw-rw-. 1 oracle oinstall 1212 Feb 1 04:10 la000002-rw-rw-rw-. 1 oracle oinstall 1082 Feb 2 03:21 la000003-rw-rw-rw-. 1 oracle oinstall 1082 Feb 2 03:21 la000004[oracle@11g dirdat]$ rm -rf la*目的端:[oracle@11g ogg]$ cd dirdat[oracle@11g dirdat]$ pwd/home/oracle/ogg/dirdat[oracle@11g dirdat]$ lltotal 16-rw-rw-rw-. 1 oracle oinstall 1370 Nov 9 07:56 ra000000-rw-rw-rw-. 1 oracle oinstall 1335 Feb 1 04:09 ra000001-rw-rw-rw-. 1 oracle oinstall 1235 Feb 2 03:21 ra000002-rw-rw-rw-. 1 oracle oinstall 1265 Feb 2 03:21 ra000003[oracle@11g dirdat]$ rm -rf ra*ok,至此旧OGG进程清除完毕。以下是重新创建相关的ogg进程 :1. 查看 mgr 进程状态,确保为 running源端:GGSCI (11g) 2> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING 目的端:GGSCI (11g) 2> info all Program Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING2. 查看 mgr 参数配置源端:GGSCI (11g) 3> view param mgrport 7809目的端:GGSCI (11g) 3> view param mgrport 78093. 创建ext进程,tail文件,data_pump进程源端:GGSCI (11g) 11> add ext exta, tranlog, begin nowEXTRACT added.GGSCI (11g) 12> add exttrail /home/oracle/ogg/dirdat/la, ext exta, MEGABYTES 20 -- 创建源trail文件EXTTRAIL added.GGSCI (11g) 13> add extract dpea, EXTTRAILSOURCE /home/oracle/ogg/dirdat/la -- 创建data_pump进程EXTRACT added.GGSCI (11g) 14> add rmttrail /home/oracle/ogg/dirdat/ra, ext dpea, MEGABYTES 20 --创建目标端trail文件RMTTRAIL added.GGSCI (11g) 15> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING EXTRACT STOPPED DPEA 00:00:00 00:02:48 EXTRACT STOPPED EXTA 00:00:00 00:09:36GGSCI (11g) 17> edit param exta --exta文件添加内容显示如下GGSCI (11g) 35> view param extaEXTRACT extasetenv (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )setenv (ORACLE_SID = orcl)USERID goldengate, PASSWORD goldengateEXTTRAIL /home/oracle/ogg/dirdat/ladynamicresolutiontable oggdemo.oggdemo;GGSCI (11g) 33> start extaSending START request to MANAGER ...EXTRACT EXTA startingGGSCI (11g) 34> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING EXTRACT STOPPED DPEA 00:00:00 01:40:39 EXTRACT RUNNING EXTA 01:47:26 00:00:01GGSCI (11g) 36> edit param dpea --dpea文件添加内容显示如下GGSCI (11g) 39> view param dpeaextract dpeasetenv (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )passthrurmthost 10.100.25.16,mgrport 7809, compressrmttrail /home/oracle/ogg/dirdat/radynamicresolutiontable oggdemo.oggdemo; 参数说明:passthru表示本进程是一个传输进程data pump,无需跟数据库交互,只需要搬运数据即可;因为data pump要传输数据到目标,所以需要配置rmthost和rmttrail指定目标主机和队列信息 GGSCI (11g) 37> start dpeaSending START request to MANAGER ...EXTRACT DPEA startingGGSCI (11g) 38> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING EXTRACT RUNNING DPEA 00:00:00 00:00:00 EXTRACT RUNNING EXTA 00:00:00 00:00:04 4. 创建目标数据库的replicate进程目的端:GGSCI (11g) 6> add rep repa, exttrail /home/oracle/ogg/dirdat/ra, nodbcheckpointREPLICAT added.参数说明: repa为进程名,一般为rep开头表示是replicat进程,后面可以加1-2位字符标识,一般与ext进程对应;exttrail表示要抽取的数据队列,注意是目标端的队列位置;nodbcheckpoint表示不使用数据库检查点。 GGSCI (11g) 17> edit param repa -- repa文件添加内容显示如下GGSCI (11g) 20> view param repareplicat repasetenv (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK)setenv (ORACLE_SID = orcl)userid goldengate, password goldengatereperror default,abenddiscardfile /home/oracle/ogg/dirrpt/repa.dsc,append, megabytes 10assumetargetdefsdynamicresolutionmap oggdemo.oggdemo, target oggdemo.oggdemo; GGSCI (11g) 18> start repaSending START request to MANAGER ...REPLICAT REPA startingGGSCI (11g) 19> info allProgram Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING REPLICAT RUNNING REPA 00:00:00 00:00:015.DML数据测试源端:SQL> select * from oggdemo;ID----------12SQL> insert into oggdemo values(3);1 row created.SQL> commit;Commit complete.目标端:SQL> select * from oggdemo;ID----------12SQL> select * from oggdemo;ID----------123ok,至此数据同步成功。 转载请标明出处。