oracle 之dataguard主庫系統崩潰之物理備庫切主庫

liqilin0429發表於2011-04-06

主庫資料庫伺服器完全崩潰的情況下。物理備庫的開啟模式為READ ONLY的情況下,可以把物理備庫切換成主庫。但是要丟失一部分資料(這個情況必須和客戶確認清楚,再切換,否則就不要切換)
切換過程
第一:檢視物理備庫的開啟模式
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

第二:檢視物理備庫的切換狀態
SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
NOT ALLOWED

第三:關閉物理備庫的當前連線回話
SQL> Alter database commit to switchover to physical standby with session shutdown;

Database altered.

第四:關閉
SQL> alter database recover managed standby database cancel
  2  ;

Database altered.

第五;關閉(或是先不要執行第四步,直接執行這步)
SQL> alter database recover managed standby database finish;
alter database recover managed standby database finish
*
ERROR at line 1:
ORA-00283: recovery session canceled due to errors
ORA-16157: media recovery not allowed following successful FINISH recovery

第六:檢視物理備庫的切換狀態
SQL> select switchover_status from v$database;

第七:切換到主庫
SQL> alter database commit to switchover to primary;

Database altered.


第八:關閉物理備庫
SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.

第九:啟動物理備庫
SQL> startup
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2213856 bytes
Variable Size             318769184 bytes
Database Buffers           83886080 bytes
Redo Buffers                4325376 bytes
Database mounted.
Database opened.


第十:檢視物理備庫的開啟模式
SQL> startup
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2213856 bytes
Variable Size             318769184 bytes
Database Buffers           83886080 bytes
Redo Buffers                4325376 bytes
Database mounted.
Database opened.

第十一:檢視物理備庫的資料庫角色
SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PRIMARY

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

相關文章