1、關(guān)掉源端抽取進(jìn)程
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、關(guān)掉目標(biāo)端進(jìn)程
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、檢查目標(biāo)端demo表
SQL> select count(1) from demo;
COUNT(1)
----------
0
5、源端插入100000表數(shù)據(jù)
SQL> insert into demo
2 select level,level||'a' from dual connect by level <= 100000;
100000 rows inserted
SQL> commit;
Commit complete
6、如果現(xiàn)在直接重啟goldengate,數(shù)據(jù)是能同步過(guò)去的,這沒有問題,也沒有難度。
我現(xiàn)在要做的操作是:
(1)結(jié)束當(dāng)前的本地日志,重新開始一個(gè)日志。
(2)然后從當(dāng)前序列重新抓取。
7、源端操作。
D:\goldengate\dirdat>ls
et000151 et000153 et000155 et000157 et000159 et000161 et000163
et000152 et000154 et000156 et000158 et000160 et000162 et000164
--當(dāng)前是164號(hào)文件,重啟的時(shí)候自動(dòng)會(huì)變成165,
--現(xiàn)在我手動(dòng)結(jié)束164號(hào)文件,然后設(shè)置抽取進(jìn)程從165號(hào)文件開始抓取。
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.
--同時(shí)我也設(shè)置投遞進(jìn)程的號(hào)也為165號(hào)文件
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、現(xiàn)在是關(guān)鍵一步,設(shè)置從哪個(gè)時(shí)間點(diǎn)開始抓取事務(wù)。
ALTER EXTRACT eora, TRANLOG, BEGIN 2011-12-14 13:30
9、重啟源端進(jìn)程。
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號(hào)文件。而164號(hào)文件沒寫滿就結(jié)束了。
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、此時(shí)查看目標(biāo)端遠(yuǎn)程日志。
D:\ggs\ggs\dirdat>dir
驅(qū)動(dòng)器 D 中的卷沒有標(biāo)簽。
卷的序列號(hào)是 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號(hào)文件結(jié)束,重新開始了165,166文件,但是和源端差一個(gè)文件號(hào)。
源端是165-167,目的端是164-166,這沒有關(guān)系。
12、設(shè)置目標(biāo)段讀取進(jìn)程,從164號(hào)文件開始讀取。
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、檢查源端端數(shù)據(jù)情況。
SQL> select count(1) from demo;
COUNT(1)
----------
100000
14、檢查目標(biāo)端數(shù)據(jù)情況
SQL> select count(1) from demo;
COUNT(1)
----------
100000