測試,ogg從歸檔日誌中抽取資料

文件搬運工發表於2018-06-06

測試原理,停掉源端和目標端的OGG, 在源端進行DML操作,然後切換日誌。然後開啟源端和目標端的OGG。看看是否會同步資料到目標端。另外檢視源端的ext程式日誌,看裡面的提示。

結論: OGG 在停掉後,進行大批量的DML操作,然後多次切換日誌後。再次開啟OGG,會從OGG中斷時候的歸檔日誌開始抽取資料。

測試過程如下:

停掉mgr 和其他的程式

GGSCI (test.us.oracle.com) 107> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     STOPPED
EXTRACT     STOPPED     EXT1        00:00:00      00:00:08
EXTRACT     STOPPED     PUMDB1      00:00:00      00:00:10


GGSCI (test.us.oracle.com) 108>

GGSCI (test02) 118> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     STOPPED
REPLICAT    STOPPED     REPDB1      00:00:00      00:00:07


GGSCI (test02) 119>

檢視當前歸檔日誌

SYS@test>archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/archive_log
Oldest online log sequence     324
Next log sequence to archive   327
Current log sequence           327
SYS@test>

SYS@test>select count(*) from bb.object1;

  COUNT(*)
----------
         0

1 row selected.

SYS@test>

現在向bb.object1表增加資料,增加完畢後,切換幾次日誌。日誌從327切換到363

SYS@test>insert into bb.object1 select * from dba_objects;

87175 rows created.

SYS@test>commit;

Commit complete.

SYS@test>alter system switch logfile;

System altered.

SYS@test>

SYS@test>archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/archive_log
Oldest online log sequence     360
Next log sequence to archive   363
Current log sequence           363
SYS@test>

啟動源端和目標端的MGR及程式

GGSCI (test.us.oracle.com) 111> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXT1        00:01:50      00:00:08
EXTRACT     RUNNING     PUMDB1      00:00:00      00:04:42


GGSCI (test.us.oracle.com) 112>


GGSCI (test02) 121> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
REPLICAT    RUNNING     REPDB1      00:00:00      00:00:06


GGSCI (test02) 122>

檢視源端的 ext1的報告。 可以看到ext抽取程式,從歸檔日誌327開始進行抽取了  

Database Language and Character Set:
NLS_LANG         = ".AL32UTF8"
NLS_LANGUAGE     = "AMERICAN"
NLS_TERRITORY    = "AMERICA"
NLS_CHARACTERSET = "AL32UTF8"

2018-06-06 16:19:11  INFO    OGG-01513  Positioning to Sequence 327, RBA 719376, SCN 0.2848195.

2018-06-06 16:19:12  INFO    OGG-01516  Positioned to Sequence 327, RBA 719376, SCN 0.2848195, Jun 6, 2018 4:14:48 PM.

2018-06-06 16:19:12  INFO    OGG-01055  Recovery initialization completed for target file /u01/ogg/dirdat/ex000002, at RBA 27260043.

2018-06-06 16:19:12  INFO    OGG-01478  Output file /u01/ogg/dirdat/ex is using format RELEASE 11.2.

2018-06-06 16:19:12  INFO    OGG-01026  Rolling over remote file /u01/ogg/dirdat/ex000002.

2018-06-06 16:19:12  INFO    OGG-01053  Recovery completed for target file /u01/ogg/dirdat/ex000003, at RBA 1112.

2018-06-06 16:19:12  INFO    OGG-01057  Recovery completed for all targets.

***********************************************************************
**                     Run Time Messages                             **
***********************************************************************

檢視目標端的資料,已經同步過來了 

SYS@orcl>select count(*) from bb.object1;

  COUNT(*)
----------
     87175

SYS@orcl>
結論, ext抽取程式,會從歸檔日誌中進行抽取,是因為有個bra地址和scn ,當ext程式中斷後,下次再啟動的時候,會從bra地址和SCN地址進行繼續抽取資料。
END 

相關文章