DG學習筆記(8)_Switchover and Failover

gdutllf2006發表於2010-03-19

DG學習筆記(8)_Switchover and Failover

 

目錄

1 Switchover

2 物理StandbySwitchover步驟

3 Failover

4 Failover for Physical Standby Database Using SQL

 

1 Switchover

 

角色轉換,Primary Database切換成 Standby Database, 將其中一個Standby切換成Primary.(資料不會丟失)

Planned role reversal

Used for OS or Hardware maintenance

用來做作業系統或硬體的日常維護

 

Note: Do not attempt a switchover operation to perform. a rolling upgrade of Oracle software; this is not supported.(什麼叫rolling upgrade ? RAC環境下的線上升級 )

Switchover and failover operations are not invoked automatically. You must initiate switchover or failover operations by using a SQL statement or by using the DG Manager or DG broker CLI.

(DGSwitchover, Failover操作不是自動觸發的.而必須透過手動的觸發.)

 

物理StandbySwitchover要求關閉和重啟Primary and Standby. 而邏輯Standby不需要關閉和重啟.

 

Switchover are only initiated on the Primary database.They cannot be initiated from the standby database.

tandby. iguration.

role is no longer capable of returning to being a standby database in the original configuration

After Switchover, Sessions for each system would need to reconnect. Data Guard does not automatically switch over sessions from one database to the other.

必須重連應用會話.

 

All but one primary instance and one standby instance in a Real Application Clusters configuration are shut down.

(RAC環境下的Switchover必須關閉其餘Instance).

 

 

2 物理StandbySwitchover步驟

 

Original Primary:

1)      Verify the SWITCHOVER_STATUS from v$DATABASE is TO_STANDBY.

 

SELECT SWITCHOVER_STATUS FROM V$DATABASE;

 

2)      ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN WAIT;

 

The WAIT option will not return control to you until the statement completes.

 

3)      Shutdown the instance and restart it without mounting the database.

SQL> SHUTDOWN IMMEDIATE;

SQL> STARTUP NOMOUNT;

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

 

4) Start the MRP process:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

 

Original Standby:

 

1)      Verify the SWITCHOVER_STATUS from V$DATABASE is SWITCHOVER_PENDING

 

SQL> Select switchover_status from v$database.

 

2)      Switch the physical standby database role to the primary role.

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

 

3) Shut down and restart the new primary database.

SQL> SHUTDOWN;

SQL> STARTUP;

 

4) Begin archiving logs to the physical standby database.

SQL> ALTER SYSTEM ARCHIVE LOG START;

SQL> ALTER SYSTEM SWITCH LOGFILE;

 

不能做Switchover的情形:

The following are situations when you will not be able to do a switchover:

Missing archives

Point in time recovery is required.you cannot switchover to some time in the past.

Production database is not open and cannot be opened

 

 

 

3 Failover

 

Primary was removed from the DG Configuration. And one of the Standby switch to Primary.(主庫被移除,其中一個備庫切成主庫,可能會有資料丟失.)

 

Failover操作由Standby發起,主要用於以下情形:

Unplanned role reversal

Use in emergency

計劃外或緊急的維護

 

Once you perform. a failover operation, there is no going back. This because the original primary database is incapacitated and the standby database that you fail over to the primary role is no longer capable of returning to being a standby database in the original configuration.

FAILOVER操作是不可逆轉的.

 

4 Failover for Physical Standby Database Using SQL

 

Original Standby:

1)  Initiate the failover operation on the standby database.

 

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

 

2)  Convert the physical standby database to the primary role.

 

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

 

3)  Register the missing archived redo logs.

SQL> ALTER DATABASE REGISTER LOGFILE ’/standby/arch_dest/arch_1_101.arc’;

這個註冊與Catalog命令的註冊有何區別?

 

Primary ?

1) To activate a standby database

SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;

 

適合做Failover的情形:

Failures such as the following are good reasons to fail over to the standby database:

Loss of the current online redo log

Loss of system or rollback tablespace

Loss of hardware and the database

Inadvertent database operations that cannot be recovered from quickly, such as dropping a tablespace

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

相關文章