容錯移轉是一個假設主要資料庫遺失的非計畫事件。套用所有可用的主要 redo
日誌之後,待命資料庫會立即轉換成主要資料庫。您可以使用倒溯和 Oracle Data Guard Broker 將原始主要資料庫恢復為實體待命資料庫。
容錯移轉之後,必須將原始主要資料庫恢復為實體待命資料庫。當您啟用倒溯資料庫和 Oracle Data Guard Broker 時,恢復原始主要資料庫會比較容易。
此範例中的步驟 3 會關閉主要內部部署資料庫,以模仿未計畫的中斷。此範例使用 Oracle Data Guard Broker 來恢復主要資料庫。
- 內部部署資料庫:
db1
- 雲端中的實體待命資料庫執行處理:
db1_phx3g7
- 在主要內部部署 Oracle Exadata Database Machine 上,以
sysdba
身分登入
- 顯示內部部署資料庫的組態。
DGMGRL> show configuration;
輸出看起來應該與下列類似:
Configuration - onpremexadr
Protection Mode: MaxPerformance
Members:
db1 - Primary database
db1_phx3g7 - Physical standby database
Warning: ORA-16809: multiple warnings detected for the member
Fast-Start Failover: Disabled
Configuration Status:
WARNING (status updated 36 seconds ago)
- 連線至主要內部部署資料庫執行處理並執行關閉,以模仿非計畫性中斷。
bash-4.2$ sqlplus / as sysdba
SQL> shutdown abort;
輸出看起來應該與下列類似:
ORACLE instance shut down.
- 在 Oracle Database Exadata Cloud Service 上,顯示資料庫執行處理的組態。
DGMGRL> show configuration;
輸出看起來應該與下列類似:
Configuration - onpremexadr
Protection Mode: MaxPerformance
Members:
db1 - Primary database
Error: ORA-12514: TNS:listener does not currently know of service requested in
connect descriptor
db1_phx3g7 - Physical standby database
Fast-Start Failover: Disabled
Configuration Status:
ERROR (status updated 0 seconds ago)
- 起始 Oracle Database Exadata Cloud Service 執行處理的容錯移轉。
DGMGRL> > failover to db1_phx3g7;
輸出看起來應該與下列類似:
Performing failover NOW, please wait...
Failover succeeded, new primary is "db1_phx3g7"
- 顯示 Oracle Database Exadata Cloud Service 中資料庫執行處理的組態。
DGMGRL> show configuration;
輸出看起來應該與下列類似:
Configuration - onpremexadr
Protection Mode: MaxPerformance
Members:
db1_phx3g7 - Primary database
Warning: ORA-16809: multiple warnings detected for the member
db1 - Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated
Fast-Start Failover: Disabled
Configuration Status:
WARNING (status updated 28 seconds ago)
- 在內部部署 Oracle Exadata Database Machine (db1)(現在為待命) 上,啟動一個節點上的執行處理。
$srvctl start instance -db db1 -instance db11
- 使用
reinstate database
命令將停止的主要資料庫設為待命資料庫。 reinstate
會將舊的主要資料庫設為待命資料庫,讓它能夠從新的主要資料庫 (啟動的待命資料庫) 接收 redo
資料。
DGMGRL> reinstate database db1;
輸出看起來應該與下列類似:
Reinstating database
"db1", please wait...Reinstatement of database "db1" succeeded
- 顯示內部部署資料庫執行處理的組態。
DGMGRL> show configuration;
輸出看起來應該與下列類似:
Configuration - onpremexadr
Protection Mode: MaxPerformance
Members:
db1_phx3g7 - Primary database
db1 - Physical standby database
Fast-Start Failover: Disabled
Configuration Status:
SUCCESS (status updated 14 seconds ago)
- 視需要切換至內部部署 Oracle Exadata Database Machine。