OGG merger process REPLICAT

OGG split REPLICAT process may reference
https://www.cndba.cn/leo1990/article/2859

1.2. OGG merger process REPLICAT

1.2.1. Stop process extract

GGSCI (cndba) 16> stop ext1

Sending STOP request to EXTRACT EXT1 ...
Request processed.

1.2.2. Check the extract process checkpoint information

GGSCI (cndba) 17> info ext1,showch

EXTRACT    EXT1      Last Started 2018-06-12 09:26   Status STOPPED
Checkpoint Lag       00:00:00 (updated 00:00:09 ago)
Log Read Checkpoint  Oracle Redo Logs
                     2018-06-12 09:54:51  Thread 1, Seqno 54, RBA 1670144
                     SCN 0.1365669 (1365669)

记录下其Write Checkpoint信息中的sequence和RBA值,例如:
Write Checkpoint #1

  GGS Log Trail

  Current Checkpoint (current write position):
    Sequence #: 28
    RBA: 1075
    Timestamp: 2018-06-12 09:55:06.669489
    Extract Trail: ./dirdat/et

1.2.3. Check the pump process checkpoint information

GGSCI (cndba) 18> info pump1,showch

EXTRACT    PUMP1     Last Started 2018-06-12 09:26   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:01 ago)
Log Read Checkpoint  File ./dirdat/et000028
                     2018-06-12 09:26:30.482435  RBA 1075
若pump进程的Current Checkpoint信息中的sequence和RBA值与ext1得到的值相等,则说明goldengate抓取的信息都已被传送到了target服务器上,可继续执行下一步骤。否则,等待并重复运行该命令。
  Current Checkpoint (position of last record read in the data source):
    Sequence #: 28
    RBA: 1075
    Timestamp: 2018-06-12 09:26:30.482435
Extract Trail: ./dirdat/et
同时,记录下其Write Checkpoint信息中的sequence和RBA值。
Write Checkpoint #1

  GGS Log Trail

  Current Checkpoint (current write position):
    Sequence #: 25
    RBA: 1419
    Timestamp: 2018-06-12 09:57:38.453158
    Extract Trail: ./dirdat/et

1.2.4. Checkpoint information to be merged replicat inspection process

GGSCI (cndba) 14> info rep1,showch
  Current Checkpoint (position of last record read in the data source):
    Sequence #: 25
    RBA: 1419
    Timestamp: 2018-06-12 09:26:31.096198
    Extract Trail: ./dirdat/et

GGSCI (cndba) 16> info rep2,showch
  Current Checkpoint (position of last record read in the data source):
    Sequence #: 25
    RBA: 1419
    Timestamp: 2018-06-12 09:26:31.096198
    Extract Trail: ./dirdat/et

若replicat进程的Current Checkpoint信息中的sequence和RBA值与pump1中得到的Write Checkpoint信息相等,则说明goldengate抓取的信息都已被apply到target 数据库,可继续执行下一步骤。否则,等待并重复运行该命令。

1.2.5. Stop replicat process

GGSCI (cndba) 17> stop rep1

Sending STOP request to REPLICAT REP1 ...
Request processed.

GGSCI (cndba) 19> stop rep2

Sending STOP request to REPLICAT REP2 ...
Request processed.

1.2.6. Modify parameters rep1

将两个replicat参数配置合并到rep1中,这里把需要单独同步的表注释即可。
GGSCI (cndba) 21> edit params rep1
--tableexclude test.test2

1.2.7. Start the process rep1

GGSCI (cndba) 22> start rep1

Sending START request to MANAGER ...
REPLICAT REP1 starting
因为这里把两个replicat进程合并到其中一个进程中,没有用新增replicat 方法来做,可以直接启动rep1进程,将rep2 进程删掉。
如果通过新增replicat方法来做的话
ADD REPLICAT rep01,EXTTRAIL ./dirdat/et
alter rep01, extseqno 25, extrba 1419
根据第四步中得到的Current checkpoint信息修改新建replicat进程的checkpoint信息,之后新建的replicat进程就会从旧replicat进程停止的位置开始抓取新的信息
然后启动新的replicat进程,删掉两个旧的replicat进程rep1,rep2

1.2.8. Start extract process

GGSCI (cndba) 2> start ext1

Sending START request to MANAGER ...
EXTRACT EXT1 starting

1.2.9. Remove the old replicat process

GGSCI (cndba) 25> dblogin userid ogg,password ogg 
Successfully logged into database.

GGSCI (cndba) 26> delete rep2
Deleted REPLICAT REP2.


GGSCI (cndba) 27> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    RUNNING     REP1        00:00:00      00:00:07

1.2.10. Test

--源端插入数据
SQL> select count(*) from test;

  COUNT(*)
----------
 40

SQL> select * from test2;

 ID NAME
---------- --------
  1 zhangsan

SQL> insert into test values(55,'test');

1 row created.
SQL> insert into test2 values(3,'test');

1 row created.

SQL> commit;
--目标端查询数据:
SQL>  select count(*) from test;

  COUNT(*)
----------
 41

SQL> select * from test2;

 ID NAME
---------- --------
  1 zhangsan
  3 test

Guess you like

Origin blog.csdn.net/leo__1990/article/details/92578927