问题背景
昨天遇到群友提问,遇到ADG备库挂了的情况
数据版本:11.2.0.4
操作系统:Centos7.9
环境:ADG主备库,主库为RAC,备库也是RAC
具体报错ORA-00449以及ORA-04021
看样子是LGWR挂了,还有个锁等待。
问题分析
先试图看下oerr报错都有什么
[oracle@rac1 ~]$ oerr ora 00449
00449, 00000, "background process '%s' unexpectedly terminated with error %s"
// *Cause: A foreground process needing service from a background
// process has discovered the process died.
// *Action: Consult the error code, and the trace file for the process.
[oracle@rac1 ~]$ oerr ora 04021
04021, 00000, "timeout occurred while waiting to lock object %s%s%s%s%s"
// *Cause: While waiting to lock a library object, a timeout occurred.
// *Action: Retry the operation later.
看起来没啥有用的分析,也是让查看日志和lock等重试
查看故障前备库的的AWR报告,按这个主机的配置来看负载并不高,但是做为一个备库session有点高。
硬解析也需要关注一下。
于是问了一下,这个备库还承担了一些查询业务。
AWR中关于SQL ordered by Version Count显示如下
结合使用情况猜测,大概率是查询ADG端遇到BUG
如何解决
现象基本符合Doc ID 2183882.1的说法,该BUG在11.2.0.4中己经解决,但是默认参数并没有打开。
所以一步到位的解决办法就是直接设置:
alter system set cursor_sharing=force scope=both;
alter system set "_adg_parselock_timeout"=500 scope=both sid='*';
医院的HIS系统好多都不写绑定变量,多源于系统开发时间较早,开发不规范导致
当然也有用19C ADG做读写业务分离很成功。
11G ADG还是有遇到一些BUG的,之前也有小伙伴遇到过RAC的ADG备库,在RAC1节点查询没有问题,在RAC2节点查询就报错ORA-00600
后来查证也是BUG导致。