Oracle goldengate先从online log日志抽取数据,然后才会从archived log中进行抽取,这可以通过下面的方式来验证.
1、主库端插入测试数据
SQL> insert into gg1.dept values(81,'1','1');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> insert into gg1.dept values(82,'2','2');
1 row created.
SQL> commit;
Commit complete.
SQL> insert into gg1.dept values(83,'3','3');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> insert into gg1.dept values(84,'4','4');
1 row created.
SQL> commit;
Commit complete.
在这里多次执行alter system switch logfile;
这里比较关键,在后面我们会删除, 82、83对应的归档日志, 如果没有覆盖掉82、83对应的online log,goldengate的extract进程不会异常中止,extract进程会优选online log。
2、在这里我们覆盖掉online log,然后删除82、83对应的归档日志。
3、查看goldengate状态,extract进程异常中止
GGSCI (slav2) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING D1PUMP 00:00:00 00:00:02
EXTRACT ABENDED EXT1 00:03:10 00:02:29
GGSCI (slav2) 2> info ext1
EXTRACT EXT1 Last Started 2013-01-21 22:15 Status ABENDED
Checkpoint Lag 00:03:10 (updated 00:02:33 ago)
Log Read Checkpoint Oracle Redo Logs
2013-01-21 22:11:50 Seqno 28, RBA 67584
[oracle@slav2 ggs]$ vi ggserr.log
2013-01-21 22:14:59 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: EXTRACT EXT1 starting.
2013-01-21 22:14:59 INFO OGG-00992 Oracle GoldenGate Capture for Oracle, ext1.prm: EXTRACT EXT1 starting.
2013-01-21 22:15:00 WARNING OGG-01423 Oracle GoldenGate Capture for Oracle, ext1.prm: No valid default archive log destination directory found for thread 1.
2013-01-21 22:15:00 INFO OGG-01513 Oracle GoldenGate Capture for Oracle, ext1.prm: Positioning to Sequence 28, RBA 67088.
2013-01-21 22:15:00 INFO OGG-01516 Oracle GoldenGate Capture for Oracle, ext1.prm: Positioned to Sequence 28, RBA 67088, Jan 21, 2013 10:11:50 PM.
2013-01-21 22:15:00 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, ext1.prm: EXTRACT EXT1 started.
2013-01-21 22:15:00 INFO OGG-01055 Oracle GoldenGate Capture for Oracle, ext1.prm: Recovery initialization completed for target file /u01/app/ggs/dirdat/lt000004, at RBA 1672.
2013-01-21 22:15:00 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, ext1.prm: Output file /u01/app/ggs/dirdat/lt is using format RELEASE 10.4/11.1.
2013-01-21 22:15:00 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext1.prm: Rolling over remote file /u01/app/ggs/dirdat/lt000004.
2013-01-21 22:15:00 INFO OGG-01053 Oracle GoldenGate Capture for Oracle, ext1.prm: Recovery completed for target file /u01/app/ggs/dirdat/lt000005, at RBA 968.
2013-01-21 22:15:00 INFO OGG-01057 Oracle GoldenGate Capture for Oracle, ext1.prm: Recovery completed for all targets.
2013-01-21 22:15:00 INFO OGG-01517 Oracle GoldenGate Capture for Oracle, ext1.prm: Position of first record processed Sequence 28, RBA 67088, SCN 0.610617, Jan 21, 2013 10:11:50 PM.