OGG 进程清除、重建

背景描述:
有时候OGG进程同步出现问题,症状某些进程起不来,而且问题一时半会儿解决不了。
最简单的办法是:用数据泵初始化数据,OGG进程重建。

1.查看源端、目的端的进程状态。   (作者OGG进程是正常的,假设进程是 abend )

源端:

GGSCI (11g) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     DPEA        00:00:00      00:00:08    
EXTRACT     RUNNING     EXTA        00:00:00      00:00:04 

目的端:
GGSCI (11g) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    RUNNING     REPA        00:00:00      00:00:07 

2. 停止 源端、目的端 除 mgr 进程,以外的所有ogg进程。

源端:

GGSCI (11g) 2> stop exta

Sending STOP request to EXTRACT EXTA …
Request processed.

GGSCI (11g) 3> stop dpea

Sending STOP request to EXTRACT DPEA …
Request processed.

目的端:

GGSCI (11g) 2> stop repa

Sending STOP request to REPLICAT REPA …
Request processed.

3. 检查源端、目的端 除 mgr 进程,以外的所有ogg进程的进程状态是否是 stop。 

源端:

GGSCI (11g) 4> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     STOPPED     DPEA        00:00:00      00:01:54    
EXTRACT     STOPPED     EXTA        00:00:00      00:02:07

目的端:

GGSCI (11g) 3> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    STOPPED     REPA        00:00:00      00:01:32

4. 用OGG管理用户连上数据库,删掉除 mgr 进程,以外的所有ogg进程。

源端:

GGSCI (11g) 5> dblogin userid goldengate,password goldengate
Successfully logged into database.

GGSCI (11g) 6> delete exta
Deleted EXTRACT EXTA.

GGSCI (11g) 7> delete dpea
Deleted EXTRACT DPEA.

目的端:

GGSCI (11g) 4> dblogin userid goldengate,password goldengate
Successfully logged into database.

GGSCI (11g) 5> delete repa
Deleted REPLICAT REPA.

5. 检查ogg进程状态。

源端:

GGSCI (11g) 8> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING 

目的端:

GGSCI (11g) 6> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING   

6. 清除参数  (注意删除文件的时候,不要多删其他无关进程文件)

源端:

[oracle@11g ogg]$ cd dirprm
[oracle@11g dirprm]$ pwd
/home/oracle/ogg/dirprm
[oracle@11g dirprm]$ ll
total 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]$ ll
total 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.prm

7.清除 Trails 文件 

源端:

[oracle@11g dirprm]$ cd ..
[oracle@11g ogg]$ cd dirdat
[oracle@11g dirdat]$ pwd
/home/oracle/ogg/dirdat
[oracle@11g dirdat]$ ll
total 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]$ ll
total 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 all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING  

目的端:

GGSCI (11g) 2> info all      

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING

2.  查看 mgr 参数配置

源端:

GGSCI (11g) 3> view param mgr

port 7809

目的端:

GGSCI (11g) 3> view param mgr

port 7809

3.   创建ext进程,tail文件,data_pump进程

源端:

GGSCI (11g) 11> add ext exta, tranlog, begin now
EXTRACT 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 all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING 
EXTRACT STOPPED DPEA 00:00:00 00:02:48 
EXTRACT STOPPED EXTA 00:00:00 00:09:36

GGSCI (11g) 17> edit param exta    –exta文件添加内容显示如下

GGSCI (11g) 35> view param exta

EXTRACT exta
setenv (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
setenv (ORACLE_SID = orcl)
USERID oggdemo, PASSWORD oggdemo
EXTTRAIL /home/oracle/ogg/dirdat/la
dynamicresolution
table oggdemo.oggdemo;

GGSCI (11g) 33> start exta

Sending START request to MANAGER …
EXTRACT EXTA starting

GGSCI (11g) 34> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING 
EXTRACT STOPPED DPEA 00:00:00 01:40:39 
EXTRACT RUNNING EXTA 01:47:26 00:00:01

GGSCI (11g) 36> edit param dpea         –dpea文件添加内容显示如下

GGSCI (11g) 39> view param dpea

extract dpea
setenv (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
passthru
rmthost 10.100.25.16,mgrport 7809, compress
rmttrail /home/oracle/ogg/dirdat/ra
dynamicresolution
table oggdemo.oggdemo;

 

参数说明:

passthru表示本进程是一个传输进程data pump,无需跟数据库交互,只需要搬运数据即可;
因为data pump要传输数据到目标,所以需要配置rmthost和rmttrail指定目标主机和队列信息

 

GGSCI (11g) 37> start dpea

Sending START request to MANAGER …
EXTRACT DPEA starting

GGSCI (11g) 38> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER 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, nodbcheckpoint
REPLICAT added.

参数说明: 

repa为进程名,一般为rep开头表示是replicat进程,后面可以加1-2位字符标识,一般与ext进程对应;

exttrail表示要抽取的数据队列,注意是目标端的队列位置;

nodbcheckpoint表示不使用数据库检查点。

 

GGSCI (11g) 17> edit param repa     — repa文件添加内容显示如下

GGSCI (11g) 20> view param repa

replicat repa
setenv (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK)
setenv (ORACLE_SID = orcl)
userid oggdemo, password oggdemo
reperror default,abend
discardfile /home/oracle/ogg/dirrpt/repa.dsc,append, megabytes 10
assumetargetdefs
dynamicresolution
map oggdemo.oggdemo, target oggdemo.oggdemo;

 

GGSCI (11g) 18> start repa

Sending START request to MANAGER …
REPLICAT REPA starting

GGSCI (11g) 19> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING 
REPLICAT RUNNING REPA 00:00:00 00:00:01

5.DML数据测试

源端:

SQL> select * from oggdemo;

ID
———-
1
2

SQL> insert into oggdemo values(3);

1 row created.

SQL> commit;

Commit complete.

目标端:

SQL> select * from oggdemo;

ID
———-
1
2

SQL> select * from oggdemo;

ID
———-
1
2
3

ok,至此数据同步成功。   转载请标明出处。

IT文库 » OGG 进程清除、重建
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址