DG故障切換及DG Broker失效配置清理
- DG故障強制切主
- DG Broker原有配置清理
DG故障強制切主
主庫發生故障無法在短時間內恢復時,需要執行主備切換。此時由于DG Broker無法連接到主庫,故不能通過Broker切換,只能手動在備庫進行切主。
--斷開備庫MRP進程
alter database recover managed standby database cancel;--手動切換備庫為新的主庫
alter database recover managed standby database finish force;
alter database commit to switchover to primary with session shutdown;--重啟備庫使得切主生效
shutdown immediate;
startup;--檢查備庫角色已轉換為PRIMARY
select open_mode,database_role from v$database;
DG Broker原有配置清理
故障切換后,需要移除舊的DG Broker配置。由于是故障切換,DG Broker配置信息沒有更新,因此不能直接通過DGMGRL命令來移除舊的配置信息。
[oracle@primarydbhost ~]$ dgmgrl / "show configuration"; [oracle@primarydbhost ~]$ dgmgrl / "remove configuration"; Error: ORA-12545: Connect failed because target host or object does not exist
Error: ORA-16625: cannot reach database "orcldb_1"[oracle@primarydbhost ~]$ dgmgrl / "show configuration"; Configuration - dg_orcldb
Protection Mode: MaxPerformance
Databases: orcldb_1 - Primary database orcldb_2 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:
ORA-12545: Connect failed because target host or object does not exist
ORA-16625: cannot reach database "orcldb_1"
DGM-17017: unable to determine configuration status[oracle@primarydbhost ~]$ dgmgrl / "remove database orcldb_1";
Connected. Primary database cannot be removed[oracle@primarydbhost ~]$ dgmgrl / "disable configuration";
Connected. Error: ORA-12545: Connect failed because target host or object does not exist
Error: ORA-16625: cannot reach database "orcldb_1"
可行的辦法是關閉dg_broker_start
參數,并清理相關配置文件,然后重新開啟該參數即可。
sys@orcldb_2> show parameter dg_brokerNAME TYPE VALUE
---------------------- ------- ---------------------------------------------
dg_broker_config_file1 string /oracle/app/product/11204/dbs/dr1orcldb_2.dat
dg_broker_config_file2 string /oracle/app/product/11204/dbs/dr2orcldb_2.dat
dg_broker_start boolean TRUEorcldb_2> alter system set dg_broker_start=false scope=both;orcldb_2> !rm /oracle/app/product/11204/dbs/dr1orcldb_2.dat
orcldb_2> !rm /oracle/app/product/11204/dbs/dr2orcldb_2.datsys@orcldb_2> alter system set dg_broker_start=true scope=both;System altered.
確認舊的DG Broker配置是否已刪除:
[oracle@primarydbhost ~]$ dgmgrl / "show configuration"
Connected. ORA-16532: Data Guard broker configuration does not existConfiguration details cannot be determined by DGMGRL