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