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
问题解决,注意参数文件修改。