首页 > 其他分享 >ADG无法切换:报错 ORA-16467

ADG无法切换:报错 ORA-16467

时间:2023-05-11 19:23:47浏览次数:46  
标签:11 16467 dest database ADG 报错 SQL ---------- alter

现象:
ADG无法切换:验证时就报错 ORA-16467

记录问题,顺便展现一次troubleshooting的心路历程。

具体查询:

在主库操作,
@primary

切换验证:

alter database switchover to demorac verify;

报错ORA-16467:

SQL> alter database switchover to demorac verify;

alter database switchover to demorac verify
*
ERROR at line 1:
ORA-16467: switchover target is not synchronized

主库alert告警日志:

ORA-16467 signalled during: alter database switchover to demorac verify...

主库传输链路并没有报错:

SQL> select error from v$archive_dest where dest_id= 2;

ERROR
-----------------------------------------------------------------

但是,如果去查v$archive_dest_status,就会发现问题,说有可解决的GAP:

SQL> select dest_id, status, gap_status from v$archive_dest_status where dest_id = 2;

   DEST_ID STATUS    GAP_STATUS
---------- --------- ------------------------
	 2 VALID     RESOLVABLE GAP

但是去备库查询,
@standby,

ADG并没有任何延迟:

SQL> select * from v$dataguard_stats;

SOURCE_DBID SOURCE_DB_ NAME		      VALUE		     UNIT			    TIME_COMPUTED		   DATUM_TIME			      CON_ID
----------- ---------- ---------------------- ---------------------- ------------------------------ ------------------------------ ------------------------------ ----------
	  0	       transport lag	      +00 00:00:00	     day(2) to second(0) interval   05/11/2023 18:16:43 	   05/11/2023 18:16:41			   0
	  0	       apply lag	      +00 00:00:00	     day(2) to second(0) interval   05/11/2023 18:16:43 	   05/11/2023 18:16:41			   0
	  0	       apply finish time			     day(2) to second(3) interval   05/11/2023 18:16:43 						   0
	  0	       estimated startup time 18		     second			    05/11/2023 18:16:43 						   0

查MOS文档资料,有一个bug:

  • Bug 33663444 - DataGuard: "alter database switchover verify" fails with ORA-16467 (Doc ID 33663444.8)

可是很快也排除掉:现象细节不完全匹配,另外这个bug正好在19.16已经修复:

[oracle@bogon ~]$ $ORACLE_HOME/OPatch/opatch lsinventory|grep 33663444
     29353271, 29706141, 26352569, 33663444, 30476768, 30092280, 30843271

但这个文档给的一些解释中也得到了一些启发:

REDISCOVERY INFORMATION:
  SELECT GAP_STATUS FROM V$ARCHIVE_DEST_STATUS with show unresolvable gap.
 
Workaround
  temporarily re-enable the disabled redo thread

首先,我们查V$ARCHIVE_DEST_STATUS已经确认是resolvable gap,不匹配但是也有问题。
然后redo thread的re-enable,这个workaround让我去想到查询redo的thread,结果发现果然有些异常:

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE	  MEMBERS ARC STATUS	       FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME	  CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
	 1	    1	    1132  209715200	   512		1 NO  CURRENT		    44911942 11-MAY-23	 9.2954E+18		       0
	 2	    1	    1130  209715200	   512		1 YES INACTIVE		    44901958 11-MAY-23	   44911931 11-MAY-23	       0
	 3	    1	    1131  209715200	   512		1 YES INACTIVE		    44911931 11-MAY-23	   44911942 11-MAY-23	       0
	 4	    2	       0  104857600	   512		1 YES UNUSED			   0			  0		       0
	 5	    2	       0  104857600	   512		1 YES UNUSED			   0			  0		       0

我这里目前主库是单实例,而备库才是RAC,可是,为何主库的redo居然会有 thread#=2 的redo?
虽然都是unused,但出现在这里就很奇怪!
不知道谁动了这个环境,想不起来做过这样的测试。但可以肯定的是,完全可以把这个不该存在的thread删除掉!

直接删除会报错:

alter database drop logfile group 4;
alter database drop logfile group 5;


SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-01567: dropping log 4 would leave less than 2 log files for instance UNNAMED_INSTANCE_2 (thread 2)
ORA-00312: online log 4 thread 2: '/flash/fast_recovery_area/DEMO/onlinelog/o1_mf_4_kxn73zny_.log'


SQL> alter database drop logfile group 5;
alter database drop logfile group 5
*
ERROR at line 1:
ORA-01567: dropping log 5 would leave less than 2 log files for instance UNNAMED_INSTANCE_2 (thread 2)
ORA-00312: online log 5 thread 2: '/flash/fast_recovery_area/DEMO/onlinelog/o1_mf_5_kxn73zqd_.log'

删除不掉就尝试去先禁用掉这个没有用的thread 2,然后再次尝试删除:
alter database disable thread 2;

SQL> alter database disable thread 2;

Database altered.

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE	  MEMBERS ARC STATUS	       FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME	  CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
	 1	    1	    1132  209715200	   512		1 NO  CURRENT		    44911942 11-MAY-23	 9.2954E+18		       0
	 2	    1	    1130  209715200	   512		1 YES INACTIVE		    44901958 11-MAY-23	   44911931 11-MAY-23	       0
	 3	    1	    1131  209715200	   512		1 YES INACTIVE		    44911931 11-MAY-23	   44911942 11-MAY-23	       0
	 4	    2	       0  104857600	   512		1 YES UNUSED			   0			  0		       0
	 5	    2	       0  104857600	   512		1 YES UNUSED			   0			  0		       0

SQL> alter database drop logfile group 4;

Database altered.

SQL> alter database drop logfile group 5;

Database altered.

SQL>
SQL>
SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE	  MEMBERS ARC STATUS	       FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME	  CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
	 1	    1	    1132  209715200	   512		1 NO  CURRENT		    44911942 11-MAY-23	 9.2954E+18		       0
	 2	    1	    1130  209715200	   512		1 YES INACTIVE		    44901958 11-MAY-23	   44911931 11-MAY-23	       0
	 3	    1	    1131  209715200	   512		1 YES INACTIVE		    44911931 11-MAY-23	   44911942 11-MAY-23	       0

删除成功!这次想来总该可以了吧?

SQL> alter database switchover to demorac verify;
alter database switchover to demorac verify
*
ERROR at line 1:
ORA-16467: switchover target is not synchronized

额,还是不行,但感觉再刺激刺激就OK了,继续尝试之前的十八般武艺(主要还是多切几次日志):

SQL> select dest_id, status, gap_status from v$archive_dest_status where dest_id = 2;

   DEST_ID STATUS    GAP_STATUS
---------- --------- ------------------------
	 2 VALID     RESOLVABLE GAP

SQL>
SQL> alter system switch logfile;

System altered.

SQL> select dest_id, status, gap_status from v$archive_dest_status where dest_id = 2;

   DEST_ID STATUS    GAP_STATUS
---------- --------- ------------------------
	 2 VALID     RESOLVABLE GAP

SQL> alter system archive log current;

System altered.

SQL> select dest_id, status, gap_status from v$archive_dest_status where dest_id = 2;

   DEST_ID STATUS    GAP_STATUS
---------- --------- ------------------------
	 2 VALID     RESOLVABLE GAP

SQL> alter system switch logfile;
alter system switch logfile;
System altered.

SQL>

System altered.

SQL>
SQL>
SQL>
SQL> alter system switch logfile;

System altered.

SQL> select dest_id, status, gap_status from v$archive_dest_status where dest_id = 2;

   DEST_ID STATUS    GAP_STATUS
---------- --------- ------------------------
	 2 VALID     NO GAP

SQL>

哎呀,直接提示没有GAP了,赶紧尝试继续切换。。

SQL> alter database switchover to demorac verify;
alter database switchover to demorac verify
*
ERROR at line 1:
ORA-16475: succeeded with warnings, check alert log for more details


SQL> !date
Thu May 11 18:36:31 CST 2023

额?成功了,但是有警告,看告警日志又是一个新的ORA-16475 错误。

2023-05-11T18:36:14.906996+08:00
alter database switchover to demorac verify
2023-05-11T18:36:15.094516+08:00
SWITCHOVER VERIFY: Send VERIFY request to switchover target DEMORAC
SWITCHOVER VERIFY WARNING: switchover target temporary files are not the same with the primary. See switchover target's alert log for details.
ORA-16475 signalled during: alter database switchover to demorac verify...

哎呀,去看看备库的alert日志:

2023-05-11T18:41:29.407685+08:00
SWITCHOVER VERIFY BEGIN
SWITCHOVER VERIFY WARNING: primary database has 5 temporary files, this database has 4 temporary files. More temp files  should be added to this database.
SWITCHOVER VERIFY COMPLETE

注意这个时间不太一致是因为两个机器时间不一样(差了5分钟),可以先不用管。
看问题本身是说临时文件,这无所谓,切换后可以自动创建。

快快来一把久违的切换吧!

--主库执行成功
alter database switchover to demorac;

--新主库demorac
alter database open;

--新备库demo
startup
recover managed standby database disconnect;

具体ADG切换参考:

嗯,终于OK了,也感觉肚子饿了,去点餐了。

标签:11,16467,dest,database,ADG,报错,SQL,----------,alter
From: https://www.cnblogs.com/jyzhao/p/17391971.html

相关文章

  • 关于el-progress percentage的值超100以及处理后端返回小数转换报错的处理
    在开发大屏幕数据项目的时候,在el-table中用el-progress展示效率,由于后端返回的是小数,前端需要把0.555555555展示成50%的格式(不展示小数点后的数字),我刚开始写控制台一直报错,用Number()转化了数值还是在控制台报percentage期望的是‘number’,但是捕抓到的是'String'的错误。最后这......
  • 淄博/中原云商有这些报错,但不影响
    1.淄博项目:到第三个报错时,项目就能运行了1)2)3) 2.中原云商 ......
  • spark-sql 启动客户端报错问题
    1.spark-sql启动报错java.lang.NoClassDefFoundError:org/apache/tez/dag/api/SessionNotRunning原因:在启动时找不到tez的jar包解决方法:将tez目录下的tez-api-0.9.1.jar复制一份到spark的jars目录下cptez-api-0.9.1.jar/usr/hdp/current/spark2-client/jars/分发到其他......
  • vue node报错ERESOLVE unable to resolve dependency tree
    解决:ERESOLVEunabletoresolvedependencytree小张不厌学于2022-08-2517:00:44发布30549收藏102文章标签:npmvue.js前端版权华为云开发者联盟该内容已被华为云开发者联盟社区收录加入社区NPM版本问题报错的解决方案在安装项目依赖时,很大可能会遇到安装不成功的问题......
  • 数据库连接池报错java.lang.NoClassDefFoundError
    第一次用c3p0,在连接时,发声如下报错java.lang.NoClassDefFoundError 经查看,发现它需要辅助包 mchange-commons-java.jar,下载放入后,即可 ......
  • ubuntu apt 安装报错:Media change: please insert the disc labeled 'Ubuntu 20.04.5
    前言如果你在Ubuntu上使用apt安装软件包时遇到"Mediachange:pleaseinsertthedisclabeled..."的错误消息,这通常是因为apt源列表中包含CD/DVD源,但你的系统中没有插入相应的安装介质(CD或DVD)。解决检查/etc/apt/sources.list文件中,是否出现CD/DVD源。类似d......
  • homebrew 安装报错 Warning: /opt/homebrew/bin is not in your PATH.
    如下报错解决方案编辑 zshrcvim~/.zshrc配置如下  exportPATH="/opt/homebrew/bin:$PATH"  ......
  • mysql中删除时报错Cannot truncate a table referenced in a foreign key constraint
    在Mysql使用Truncate截断表时,提示Cannottruncateatablereferencedinaforeignkeyconstraint(monitoritem,CONSTRAINTmonitortaskpollutant_monitortask_fk)。这是因为存在外键约束导致的无法删除,我们可以先关闭外键约束,删除后再启动外键约束。1、检查外键约束SELE......
  • ssl握手失败报错00000002:lib(0):func(0):reason(2)
    开发过程中ssl握手失败,使用demo验证是ok的,说明证书没啥问题,抓包看服务端收到客户端的ServerHello后就回了fin包,打印ssl的错误信息,00000002:lib(0):func(0):reason(2),错误码2,在ssl.h里查看到是#defineSSL_ERROR_WANT_READ       2怀疑是不是非阻塞socket导......
  • VCENTER 6.7添加主机报错提示你授权文件报错解决方法
    原文:https://www.fanjiayu.com/mengquan/7出现故障环境为Vcenter6.740000Esxi6.7update314320388在添加新ESXI主机时进度条在80%报错出现了常规系统错误:UnabletopushCAcertificatesandCRLstohostxxx.xxx.xxx.xxx在充分排除网络原因之后参考官方文档,发现需要更改......