部署 11G 物理DataGuard時 ALTER DATABASE OPEN 報錯

feelpurple發表於2015-11-04
採用的配置方法透過DUPLICATE命令實時從主庫同步到備庫。

duplicate target database for standby nofilenamecheck from active database;

當主庫傳輸完所有資料檔案到備庫上後,想將備庫啟動到OPEN狀態報錯

SQL> ALTER DATABASE OPEN;
ALTER DATABASE OPEN
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1:
'/ORADATA/data/GTFDBDG/datafile/o1_mf_system_8oqlcnin_.dbf

備庫啟動日誌應用

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;


檢查歸檔日誌的同步情況,發現一條歸檔都沒有傳輸到備庫

SELECT SEQUENCE#,THREAD#,APPLIED FROM GV$ARCHIVED_LOG ORDER BY SEQUENCE#;

no rows selected

可以判斷是主庫無法同步歸檔日誌到備庫

主庫是兩節點的 RAC ,檢視主庫兩節點的 alert 日誌,沒有明顯的報錯資訊

檢查主庫的配置引數,沒有錯誤。重新配置主庫下面引數後, alert 日誌報錯

ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=BOTH;
Wed Nov 04 05:37:34 2015
PING[ARC2]: Heartbeat failed to connect to standby 'gtfdbdg'. Error is 16057. 
Wed Nov 04 05:37:36 2015
Thread 1 advanced to log sequence 13837 (LGWR switch)
  Current log# 1 seq# 13837 mem# 0: +REDO1/gtfdb/onlinelog/group_1.256.833906321
  Current log# 1 seq# 13837 mem# 1: +REDO2/gtfdb/onlinelog/group_1.256.833906323
Wed Nov 04 05:37:36 2015
ARC3: Archivelog destination LOG_ARCHIVE_DEST_2 disabled: destination Data Guard configuration error

檢查備庫的 LOG_ARCHIVE_CONFIG 引數,發現配置有錯

SQL> show parameter log_archive_config


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_config     string DG_CONFIG=(gftdb,gtfdbdg)

更改備庫的 LOG_ARCHIVE_CONFIG 引數

SQL> alter system set log_archive_config='DG_CONFIG=(gtfdb,gtfdbdg)' scope=both sid='*';

備庫啟動日誌應用

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;


檢查歸檔日誌的同步情況,等待主庫傳輸過來的歸檔日誌全部被備庫應用之後,再次將備庫置為 OPEN READ 狀態

SELECT SEQUENCE#,THREAD#,APPLIED FROM GV$ARCHIVED_LOG ORDER BY SEQUENCE#;

 SEQUENCE#    THREAD# APPLIED
---------- ---------- ---------
      5019    2 YES
      5020    2 YES
      5021    2 YES
      5022    2 YES
      5023    2 YES
      5024    2 YES
      5025    2 YES
      5026    2 YES
      5027    2 YES
      5028    2 YES
      5029    2 YES


 SEQUENCE#    THREAD# APPLIED
---------- ---------- ---------
      5030    2 YES
      5031    2 YES
      5032    2 YES
      5033    2 YES
      5034    2 IN-MEMORY

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
 
ALTER DATABASE OPEN;

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

備庫狀態正常,實現日誌實時應用

SQL> select database_role,switchover_status,open_mode from v$database;

DATABASE_ROLE SWITCHOVER_STATUS    OPEN_MODE
---------------- -------------------- --------------------
PHYSICAL STANDBY NOT ALLOWED      READ ONLY WITH APPLY


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-1822519/,如需轉載,請註明出處,否則將追究法律責任。

相關文章