DataGuard:Logical Standby Switchover

oracle_kai發表於2009-05-15

DataGuard:Logical Standby Switchover

由於logical standby的結構要比physical的複雜,所以logical standbyswitchover要比physical稍微複雜些,很多時候轉換不成功,都是dataguard的一些引數log_archive_dest_Nlog_archive_dest_state_N,db_file_name_convert,log_file_name_convert   ,log_archive_config等設定不符合要求引起的,所以在做Logical Standby Switchover的時候,一定要事先檢查相關的引數配置是否符合要求。

 

整個切換步驟大致如下:

 

首先要檢查standbyprimary庫的引數設定,各引數的設定和physical的設定一樣,對於邏輯standby,需要確認是否有standby redo log。確認都ok後繼續

 

1.STANDBY 庫停止redo應用

    alter database stop logical standby apply;

2.primary prepare switchover logical standby ;

    alter database prepare to switchover to logical standby ;

    db1>select switchover_status from v$database;

SWITCHOVER_STATUS

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

PREPARING SWITCHOVER

3.standby prepare switchover

    alter database prepare to switchover to primary;

db2>select switchover_status from v$database;

SWITCHOVER_STATUS

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

PREPARING SWITCHOVER

 

4.確認primary 庫查詢結果是TO LOGICAL STANDBY

select switchover_status from v$database;

SWITCHOVER_STATUS

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

TO LOGICAL STANDBY

 

如果為TO LOGICAL STANDBY  則表示可以switchover,如果為PREPARING SWITCHOVER ,則表示引數設定還有問題,無法去做switchover(standby 庫中的log_archive_dest_2 log_archive_dest_state_2引數沒有設定或者設定不正確,可能會導致PREPARING SWITCHOVER),如下

db2>alter database commit TO SWITCHOVER TO LOGICAL STANDBY;

alter database commit TO SWITCHOVER TO LOGICAL STANDBY

*

ERROR at line 1:

ORA-16217: prepare to switchover has not completed

ORA-06512: at line 1

 

本例中是因standby 庫中的log_archive_dest_state_2 錯誤設定為'DEFER'導致的

)

 

5.轉換primary為邏輯standby

   alter database commit to switchover to logical standby;

6.檢查standby庫的狀態,正常為:TO PRIMARY

    select switchover_status from v$database;

7.轉換邏輯standbyprimary

    alter database commit to switchover to primary;

 

8.啟動新邏輯standbysql應用

    alter database start logical standby apply immediate

9.檢查primary庫的操作是否可以在standby庫中應用

primary上作一些dml操作,檢視standby是否有同步。

具體略……

 

Logical Standby Switchover切換結束

 

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

相關文章