OGG中断后,重新同步操作

模拟一下goldengata中断后,重新同步操作:

1、关掉源端抽取进程

GGSCI (20081122-2105) 15> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

EXTRACT RUNNING EORA 00:00:00 00:00:03

EXTRACT RUNNING PUMP_SO 00:00:00 00:00:09

 

 

GGSCI (20081122-2105) 16> stop eora

Sending STOP request to EXTRACT EORA ...

Request processed.

 

 

GGSCI (20081122-2105) 17> stop pump_so

Sending STOP request to EXTRACT PUMP_SO ...

Request processed.

 

 

GGSCI (20081122-2105) 18> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

EXTRACT STOPPED EORA 00:00:00 00:00:07

EXTRACT STOPPED PUMP_SO 00:00:00 00:00:02

 

 

2、关掉目标端进程

GGSCI (PC0527ZQM) 16> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

REPLICAT RUNNING REPL 00:00:00 00:00:09

 

 

GGSCI (PC0527ZQM) 17> stop repl

Sending STOP request to REPLICAT REPL ...

Request processed.

 

 

GGSCI (PC0527ZQM) 18> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

REPLICAT STOPPED REPL 00:00:00 00:00:02

 

 

3、检查源端demo表

SQL> select count(*) from demo;

COUNT(*)

----------

0

 

4、检查目标端demo表

SQL> select count(1) from demo;

COUNT(1)

----------

0

 

5、源端插入100000表数据

SQL> insert into demo

2 select level,level||'a' from dual connect by level <= 100000;

100000 rows inserted

SQL> commit;

Commit complete

 

 

6、如果现在直接重启goldengate,数据是能同步过去的,这没有问题,也没有难度。

我现在要做的操作是:

(1)结束当前的本地日志,重新开始一个日志。

(2)然后从当前序列重新抓取。

 

 

7、源端操作。

D:\goldengate\dirdat>ls

et000151 et000153 et000155 et000157 et000159 et000161 et000163

et000152 et000154 et000156 et000158 et000160 et000162 et000164

 

 

--当前是164号文件,重启的时候自动会变成165,

--现在我手动结束164号文件,然后设置抽取进程从165号文件开始抓取。

 

GGSCI (20081122-2105) 19> alter extract eora etrollover

2011-12-14 13:43:21 INFO OGG-01520 Rollover performed. For each affected output trail of

Version 10 or higher format, after starting the source extract, issue ALTER EXTSEQNO for that trail's reader

(either pump EXTRACT or REPLICAT) to move the reader's scan to the new trail file; it will not happen automatically.

EXTRACT altered.

 

 

GGSCI (20081122-2105) 20> alter eora extseqno 165,extrba 0

EXTRACT altered.

 

 

--同时我也设置投递进程的号也为165号文件

 

GGSCI (20081122-2105) 22> alter extract pump_so etrollover

2011-12-14 13:46:03 INFO OGG-01520 Rollover performed. For each affected output trail of

Version 10 or higher format, after starting the source extract, issue ALTER EXTSEQNO for that trail's rea

der (either pump EXTRACT or REPLICAT) to move the reader's scan to the new trail file; it will not happen automatically.

EXTRACT altered.

 

 

GGSCI (20081122-2105) 23> alter pump_so extseqno 165,extrba 0

EXTRACT altered.

 

 

8、现在是关键一步,设置从哪个时间点开始抓取事务。

ALTER EXTRACT eora, TRANLOG, BEGIN 2011-12-14 13:30

 

 

9、重启源端进程。

GGSCI (20081122-2105) 25> start eora

Sending START request to MANAGER ('GGSMGR') ...

EXTRACT EORA starting

 

 

GGSCI (20081122-2105) 26> start pump_so

Sending START request to MANAGER ('GGSMGR') ...

EXTRACT PUMP_SO starting

 

 

GGSCI (20081122-2105) 27> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

EXTRACT RUNNING EORA 00:00:00 00:00:05

EXTRACT RUNNING PUMP_SO 00:00:00 00:05:15

 

 

10、看看源端本地日志,重新生成了165、166、167号文件。而164号文件没写满就结束了。

D:\goldengate\dirdat>ls -l

总用量 44552

-rwxrwx---+ 1 Administrators SYSTEM 359769 十一 16 08:58 et000151

-rwxrwx---+ 1 Administrators SYSTEM 17448 十二 5 09:39 et000152

-rwxrwx---+ 1 Administrators SYSTEM 978 十二 14 10:48 et000153

-rwxrwx---+ 1 Administrators SYSTEM 1270 十二 14 10:50 et000154

-rwxrwx---+ 1 Administrators SYSTEM 919 十二 14 11:16 et000155

-rwxrwx---+ 1 Administrators SYSTEM 1414 十二 14 11:17 et000156

-rwxrwx---+ 1 Administrators SYSTEM 1414 十二 14 11:17 et000157

-rwxrwx---+ 1 Administrators SYSTEM 919 十二 14 11:30 et000158

-rwxrwx---+ 1 Administrators SYSTEM 1559 十二 14 11:30 et000159

-rwxrwx---+ 1 Administrators SYSTEM 1500 十二 14 11:33 et000160

-rwxrwx---+ 1 Administrators SYSTEM 919 十二 14 13:25 et000161

-rwxrwx---+ 1 Administrators SYSTEM 9999953 十二 14 13:25 et000162

-rwxrwx---+ 1 Administrators SYSTEM 9999978 十二 14 13:31 et000163

-rwxrwx---+ 1 Administrators SYSTEM 2570306 十二 14 13:31 et000164

-rwxrwx---+ 1 Administrators SYSTEM 9999953 十二 14 13:51 et000165

-rwxrwx---+ 1 Administrators SYSTEM 9999961 十二 14 13:51 et000166

-rwxrwx---+ 1 Administrators SYSTEM 2569952 十二 14 13:51 et000167

 

 

11、此时查看目标端远程日志。

D:\ggs\ggs\dirdat>dir

驱动器 D 中的卷没有标签。

卷的序列号是 30DD-ABBC

 

D:\ggs\ggs\dirdat 的目录

 

2011-12-14 13:51 <DIR> .

2011-12-14 13:51 <DIR> ..

2011-12-05 09:39 17,595 pt000151

2011-12-05 10:13 1,167 pt000152

2011-12-14 10:48 1,150 pt000153

2011-12-14 11:02 1,543 pt000154

2011-12-14 11:13 1,234 pt000155

2011-12-14 11:27 2,266 pt000156

2011-12-14 11:31 1,318 pt000157

2011-12-14 11:33 1,360 pt000158

2011-12-14 11:34 1,983 pt000159

2011-12-14 13:26 9,999,996 pt000161

2011-12-14 13:31 9,999,915 pt000162

2011-12-14 13:31 2,570,455 pt000163

2011-12-14 13:51 9,999,996 pt000164

2011-12-14 13:51 9,999,884 pt000165

2011-12-14 13:51 2,570,115 pt000166

 

可以看出,163号文件结束,重新开始了165,166文件,但是和源端差一个文件号。

源端是165-167,目的端是164-166,这没有关系。

 

 

12、设置目标段读取进程,从164号文件开始读取。

GGSCI (PC0527ZQM) 21> alter REPLICAT repl extseqno 164, extrba 0

REPLICAT altered.

 

 

GGSCI (PC0527ZQM) 23> start repl

Sending START request to MANAGER ('GGSMGR') ...

REPLICAT REPL starting

 

 

GGSCI (PC0527ZQM) 24> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

REPLICAT RUNNING REPL 00:00:00 00:00:12

 

 

13、检查源端端数据情况。

SQL> select count(1) from demo;

COUNT(1)

----------

100000

 

14、检查目标端数据情况

SQL> select count(1) from demo;

COUNT(1)

----------

100000

 

至此,goldengate 中断后,又重新同步成功。下面的命令非常关键:


--前滚重新生成一个新的队列文件

alter extract xxx etrollover

 


--从指定时间重新抓取(重新抓取数据前提:归档文件没有删除)

ALTER EXTRACT xxx, TRANLOG, BEGIN 2010-12-31 08:00

 


--重置抽取进程,本地文件序列号从0开始生成。

alter extract ext1,extseqno 0,extrba 0

 

 

--重置读取进程,重新从0号trial文件开始读取。

alter replicat rep1,extseqno 0,extrba 0

转载:http://blog.itpub.net/7204674/viewspace-713290/

posted on 2016-06-22 15:35  l3985  阅读(1486)  评论(0编辑  收藏  举报

导航