1. 程式人生 > 實用技巧 >DG問題:ORA-16416: No viable Physical Standby switchover targets available

DG問題:ORA-16416: No viable Physical Standby switchover targets available

ORA-16416: No viable Physical Standby switchover targets availabl&ORA-16047&ORA-02097&ORA-16025& ORA-12154

1.報錯資訊:

ORA-16416: No viable Physical Standby switchover targets available
ORA-16047: DGID mismatch between destination setting
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16025: parameter LOG_ARCHIVE_DEST_2 contains repeated or conflicting attributes
ORA-12154: TNS:could not resolve the connect identifier specified

2.實際環境:

DG搭建完成,主備切換順利,由備庫切回主庫出現問題,報錯如上其他錯誤為後續處理產生。

SYS@stddb>alter database commit to switchover to physical standby;
alter database commit to switchover to physical standby
*
ERROR at line 1:
ORA-16416: No viable Physical Standby switchover targets available

3.解決:

排查過程:

1)檢視是否存在GAP

SYS@stddb>select * from  V$ARCHIVE_GAP;

no rows selected

2) 檢視歸檔程序狀態

SYS@stddb>select process,status from v$managed_standby;

PROCESS   STATUS
--------- ------------
ARCH      CLOSING
ARCH      CLOSING
ARCH      CONNECTED
ARCH      CLOSING

3)檢視此時備庫的切換狀態,為not allowed存在異常

SYS@stddb> select name,database_role,switchover_status from v$database;

NAME      DATABASE_ROLE    SWITCHOVER_STATUS
--------- ---------------- --------------------
PROE      PRIMARY          NOT ALLOWED

4)檢視歸檔資訊報錯,確定報錯原因。備庫所指定的歸檔日誌路徑存在問題。

SYS@stddb>select status,error from v$archive_dest;

STATUS    ERROR
--------- -----------------------------------------------------------------
VALID     (null)
DISABLED  ORA-16047: DGID mismatch between destination setting and target
          database
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16025: parameter LOG_ARCHIVE_DEST_2 contains repeated or conflicting attributes
# 檢視備庫歸檔引數設定
SYS@stddb>show parameter log_archive_dest_2;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string      service=stddb valid_for=(onlin
                                                 e_logfiles,primary_role) db_un
                                                 ique_name=pridb

5)這裡引數的值存在問題,將stddb修改為了pridb(這裡仍然不正確)。

SYS@stddb> alter system set log_archive_dest_2='service=proe valid_for=(online_logfiles,primary_role) db_unique_name=pridb' scope=both;

6)重新檢視當前歸檔報錯信,仍然不是有效的。

SYS@stddb>select status,error from v$archive_dest;

STATUS    ERROR
--------- -----------------------------------------------------------------
VALID     (null)
DEFERRED  (null)

7)手動啟用備庫切換後歸檔路徑啟用

SYS@stddb>alter system set log_archive_dest_state_2=enable;

System altered.
# 再次檢視報錯改變,為監聽問題
SYS@stddb>select status,error from v$archive_dest;

STATUS    ERROR
--------- -----------------------------------------------------------------
VALID     (null)
ERROR     ORA-12154: TNS:could not resolve the connect identifier specified

#pridb為DG中的標識,資料庫的服務名仍為proe。確定錯誤後進行相應修改
SYS@stddb>alter system set log_archive_dest_2='service=proe valid_for=(online_logfiles,primary_role) db_unique_name=pridb' scope=both;

System altered.

8)檢視資料庫角色以及切換狀態已經恢復。

SYS@stddb>select name,database_role,switchover_status from v$database;

NAME      DATABASE_ROLE    SWITCHOVER_STATUS
--------- ---------------- --------------------
PROE      PRIMARY          TO STANDBY

問題解決,注意引數檔案修改。



來自為知筆記(Wiz)