DG物理standby,failover步驟

panpong發表於2014-09-09

DG物理standbyfailover步驟

       環境為11gR2oracle linux 6.4;物理standby,單例項;假設primarydb20)異常關閉資料庫,需要切換物理standbydb66)為新primary 資料庫;

步驟1:檢查歸檔日誌是否缺失

       如果異常的primary資料庫還能夠mount上,則啟動到mount狀態,然後執行SQL,補發日誌;

       SQL> ALTER SYSTEM FLUSH REDO TO target_db_name;

target_db_name db_unique_namelog_archive_dest_n中指定的;如果執行成功,則可以保證資料無丟失;

       如果異常主庫不能mount,則需要複製備庫缺失的歸檔日誌到備庫,然後註冊;

               SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1';

 

步驟2:備庫停止redo應用

       db66

       SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

 

步驟3:手動完成所有redo應用

       SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

如果執行沒有報任何錯誤,則執行步驟4;如果報錯並不能夠解決,則執行activate    SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;

然後執行步驟6

 

步驟4:查詢備庫狀態

       SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS

-----------------

TO PRIMARY

1 row selected

如果SWITCHOVER_STATUS TO PRIMARY SESSIONS ACTIVE值,為正常狀態,可以switchoverprimary

 

步驟5:切換到主庫

       SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

 

步驟6:開啟新主庫到open

       SQL> ALTER DATABASE OPEN;

       開啟新主庫;備份新主庫,然後啟動其他物理備庫已經停止的日誌應用;

 

開啟新主庫是報錯:

SQL> startup open

ORACLE instance started.

 

Total System Global Area  839282688 bytes

Fixed Size                  2233000 bytes

Variable Size             637537624 bytes

Database Buffers          192937984 bytes

Redo Buffers                6574080 bytes

Database mounted.

ORA-03113: end-of-file on communication channel

Process ID: 12427

Session ID: 191 Serial number: 3

 

檢視alert日誌檔案,如下:

Error 12514 received logging on to the standby

LGWR: Error 12514 verifying archivelog destination LOG_ARCHIVE_DEST_2

Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED

LGWR: Continuing...

LGWR: Minimum of 1 applicable standby database required

Errors in file /u01/app/oracle/diag/rdbms/db66/oradb/trace/oradb_lgwr_12367.trc:

ORA-16072: a minimum of one standby database destination is required

LGWR (ospid: 12367): terminating the instance due to error 16072

System state dump requested by (instance=1, osid=12367 (LGWR)), summary=[abnormal instance termination].

System State dumped to trace file /u01/app/oracle/diag/rdbms/db66/oradb/trace/oradb_diag_12357.trc

Dumping diagnostic data in directory=[cdmp_20140228172732], requested by (instance=1, osid=12367 (LGWR)), summary=[abnormal instance termination].

Instance terminated by LGWR, pid = 12367

       透過上面的內容,發現報錯在歸檔日誌位置LOG_ARCHIVE_DEST_2,這個引數設定DGprimary資料庫的日誌傳送;由於原來的DGmaximize protect模式,而在failover後,原primary無法達到,則報錯;修改DG的保護模式為maximize availability即可

SQL> alter database set standby database to maximize availability;

 

Database altered.

SQL> select protection_mode,protection_level from v$database;

 

PROTECTION_MODE      PROTECTION_LEVEL

-------------------- --------------------

MAXIMUM AVAILABILITY RESYNCHRONIZATION

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

相關文章