ORA-16139 Oracle DG無法正常切換

蘭在晨發表於2014-10-10

一、系統環境:
DB version:Oracle 10.2.0.1
OS version:Oracle Linux 5

二、問題描述:
 對DG進行主備庫切換,第一次從主庫切(A機)換成備庫(B機)時正常切完,並且主庫的資料正常同步到備庫.再次切換時備庫(A機)無法切換回主庫,提示ORA-16129.但是主庫(B機)能夠正常切換到備庫狀態。

錯誤提示:
  1* alter database commit to switchover to primary with session shutdown
SYS@DGDA>/
alter database commit to switchover to primary with session shutdown
*
ERROR at line 1:
ORA-16139: media recovery required

此時備庫的切換狀態為:
SYS@DGDA>select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SWITCHOVER LATENT

如下是備庫(A機)上的alert日誌:
RFS[6]: Assigned to RFS process 11056
RFS[6]: Identified database type as 'physical standby'
RFS[6]: Archived Log: '/home/oracle/archive/DGDA/1_28_860002427.arc'
Thu Oct  9 10:19:02 2014
alter database commit to switchover to primary with session shutdown
Thu Oct  9 10:19:02 2014
ALTER DATABASE SWITCHOVER TO PRIMARY (DGDA)
Thu Oct  9 10:19:02 2014
If media recovery active, switchover will wait for completion
Database not available for switchover
  End-Of-REDO archived log file has been received
  Archived log files detected beyond End-Of-REDO
  Incomplete recovery SCN:0:411564 archive SCN:0:412008
Database not available for switchover
  End-Of-REDO archived log file has been received
  Archived log files detected beyond End-Of-REDO
  Incomplete recovery SCN:0:411564 archive SCN:0:412008
Switchover: Media recovery required - standby not in limbo
ORA-16139 signalled during: alter database commit to switchover to primary with session shutdown...
三、解決方法
通過alert日誌可以看到應該是還有日誌沒有被應用導致無法切換。於是在備庫(A機)上執行應用日誌命令:

SYS@DGDA>alter database recover managed standby database disconnect from session;
Database altered.

SYS@DGDA>select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
此時再次檢視狀態發現已經可以轉換了。
然後繼續執行切換操作
SYS@DGDA>alter database commit to switchover to primary with session shutdown
SYS@DGDA>/
Database altered.
SYS@DGDA>shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SYS@DGDA>startup
ORACLE instance started.
Total System Global Area  536870912 bytes
Fixed Size                  1220460 bytes
Variable Size             146800788 bytes
Database Buffers          385875968 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

問題解決。

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

相關文章