DataGuard:Physical Standby Switchover

oracle_kai發表於2009-05-14

DataGuard:Physical Standby Switchover

 

基本步驟:

1.對待轉換的primary,standby資料庫的初始化作相應的調整

2.主庫轉換,shutdown後啟動到mount狀態,應用redo recover

3.standby庫轉換,並open

4.測試驗證

 

<1> primary庫引數調整

    增加standby redo logfile ,因為我們現在是在maximize protection

       alter database add standby logfile group 4 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO04.LOG') SIZE 50M

       alter database add standby logfile group 5 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO05.LOG') SIZE 50M

       alter database add standby logfile group 6 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO06.LOG') SIZE 50M

       alter database add standby logfile group 7 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO07.LOG') SIZE 50M

 

增加引數fal_serverfal_clientdb_file_name_convertlog_file_name_convertstandby_file_managementlog_archive_dest_3

        log_archive_dest_state_3(用於作為備庫時存放主庫的archive log)

        db1>alter system set fal_client='db1';

        db1>alter system set fal_server='db2';

        db1>alter system set db_file_name_convert='C:\oracle\product\10.2.0\oradata\db2','C:\oracle\product\10.2.0\oradata\db1' scope=spfile;

        db1>alter system set db_file_name_convert='C:\oracle\product\10.2.0\oradata\db2','C:\oracle\product\10.2.0\oradata\db1' scope=spfile;

        db1>alter system set log_archive_dest_3='location=c:\arch\db1\standby valid_for=(standby_logfiles,standby_roles)';

        db1>alter system set log_archive_dest_state_3='enable';

 

<2> standby 庫引數調整

 

        db2>alter system set log_archive_dest_3='service=db1 lgwr sync affirm valid_for=(online_logfiles,primary_roles) db_unique_name=db1';

    

        db2>alter system set log_archive_dest_state_3='enable';

 

         檢查standby庫的歸檔設定,確保處於force logging 歸檔模式

 

         db2>select NAME,LOG_MODE,FORCE_LOGGING,DB_UNIQUE_NAME from v$database;

 

                             NAME      LOG_MODE     FOR DB_UNIQUE_NAME

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

                              DB1       ARCHIVELOG      YES      db2

 

<3> primary庫端切換動作

 

       select database_role,switchover_status from v$database;

       如果是to standby 表可以正常切換.

  直接執行 ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;

  否則執行: ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

 

       db1>select DB_UNIQUE_NAME,PROTECTION_MODE,PROTECTION_LEVEL,SWITCHOVER_STATUS from v$database;

 

                           DB_UN PROTECTION_MODE      PROTECTION_LEVEL     SWITCHOVER_STATUS

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

                         db1   MAXIMUM PROTECTION   MAXIMUM PROTECTION   SESSIONS ACTIVE

 

        db1>alter database  commit to switchover to physical standby with session shutdown ;

       

        該語句會把當前的redo歸檔,並在standby庫上recover後,原primary角色轉換為standby

 

<4> standby端切換動作

如果是SWITCHOVER_STATUS TO PRIMARY 表可以正常切換. 否則,檢查之前的操作及引數設定。

        DB_UNIQUE_NAME  PROTECTION_MODE      PROTECTION_LEVEL     SWITCHOVER_STATUS

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

            db2             MAXIMUM PROTECTION   MAXIMUM PROTECTION   TO PRIMARY

db1>alter database  commit to switchover to physical standby with session shutdown ;

 

switchover切換結束

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

相關文章