DG物理standby,switchover步驟

panpong發表於2014-09-09

DG物理standbyswitchover步驟

       環境為11gR2oracle linux 6.4;物理standby,單例項;

步驟1:查詢primary資料庫的switchover_status

       SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

    SWITCHOVER_STATUS

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

     TO STANDBY

     1 row selected

如果SWITCHOVER_STATUS TO STANDBY SESSIONS ACTIVE值,為正常狀態,可以switchover為物理standby

 

步驟2primary資料庫上開始執行switchover

       SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

這個SQL語句將主資料庫轉換成一個物理備用資料庫。當前控制檔案備份到當前SQL會話切換前的跟蹤檔案,如果必要的話可以利用其重建控制檔案。

 

步驟3:重啟原primary資料庫到mount狀態

       SQL> SHUTDOWN ABORT;

    SQL> STARTUP MOUNT;

 

步驟4:驗證物理standby狀態

查詢standby資料庫的switchover狀態為TO_PRIMARY

    SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

    SWITCHOVER_STATUS

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

    TO_PRIMARY

    1 row selected

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

 

步驟5standby資料庫上開始執行switchover

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

 

步驟6:開啟新primary資料庫到open狀態

       SQL> ALTER DATABASE OPEN;

 

步驟7:啟動新物理standby資料庫redo 應用

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

       注意,如果有多個standby,檢查其他standbyredo 應用是否停止,如果是則重新啟動;

 

上面7步驟簡單即:

db66(primary)

       SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

       SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

       SQL> SHUTDOWN ABORT;

    SQL> STARTUP MOUNT;

db20(target standby)

       SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

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

       SQL> ALTER DATABASE OPEN;

db66(primary)

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

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

相關文章