ORACLE dataguard 主備庫延遲 using current logfile
阿新 • • 發佈:2018-11-23
一. 問題描述:
BI分析部門反映夜間拉取的ORACLE備庫資料和業務部門匯入主庫的資料不一致,之間相差近2個小時。二. 問題分析:
第一反映備庫歸檔有GAP,主備庫延遲,經過查詢發現主備庫歸檔並無延遲第二種可能性夜間網路延遲等故障導致主備庫資料不一致,經過檢查alert等並未發現任何異常 手工在主庫做測試新建test表,插入資料.....發現確實未同步到備庫,且一切正常無任何報錯等。SQL> select process, status, sequence# , ACTIVE_AGENTS from v$managed_standby; PROCESS STATUS SEQUENCE# ACTIVE_AGENTS --------- ------------ ---------- ------------- ARCH CLOSING 1468 0 ARCH CLOSING 1469 0 ARCH CONNECTED 0 0 ARCH CLOSING 1470 0 RFS IDLE 0 0 RFS IDLE 1471 0 RFS IDLE 0 0 MRP0 WAIT_FOR_LOG 1471 41 RFS IDLE 0 0 9 rows selected.
查詢備庫v$dataguard_stats檢視:主庫測試: SQL> create table tevis (id number(10), 2 name varchar2(10)); Table created. SQL> insert into tevis values(1, 'anhui'); 1 row created. SQL> commit; Commit complete. SQL> 備庫查詢: SQL> select * from tevis; select * from evisevis * ERROR at line 1: ORA-00942: table or view does not exist SQL>
發現apply log竟已經達到了4h只多。 手工 alter system switch logfile; 發現備庫測試資料tevis表資料已經同步,而且v$dataguard_stats中apply log 為零。 因此:導致主備庫延遲的原因為 not apply current logfileSQL> select * from v$dataguard_stats ; NAME VALUE UNIT TIME_COMPUTED DATUM_TIME -------------------------------- -------------------- ------------------------------ ------------------------------ ------------------------------ transport lag +00 00:00:00 day(2) to second(0) interval 09/04/2017 16:03:23 09/04/2017 16:03:22 apply lag +00 04:02:49 day(2) to second(0) interval 09/04/2017 16:03:23 09/04/2017 16:03:22 apply finish time +00 00:00:00.290 day(2) to second(3) interval 09/04/2017 16:03:23 estimated startup time 9 second 09/04/2017 16:03:23 SQL>
三. 問題處理:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.
SQL>
再去查詢檢視v$dataguard_stats
SQL> select * from v$dataguard_stats;
NAME VALUE UNIT TIME_COMPUTED DATUM_TIME
-------------------------------- -------------------- ------------------------------ ------------------------------ ------------------------------
transport lag +00 00:00:00 day(2) to second(0) interval 09/04/2017 16:10:54 09/04/2017 16:10:52
apply lag +00 00:00:00 day(2) to second(0) interval 09/04/2017 16:10:54 09/04/2017 16:10:52
apply finish time day(2) to second(3) interval 09/04/2017 16:10:54
estimated startup time 9 second 09/04/2017 16:10:54
SQL>