代码改变世界

记录一则DG遭遇ORA-00088的案例

2019-06-20 17:38 AlfredZhao 阅读(...) 评论(...) 编辑 收藏

测试环境:RHEL 5.4 + Oracle 11.2.0.3 DG
现象:起初是在使用DG Broker进行switchover切换测试时,报错ORA-16775,提示有可能有数据丢失,不允许switchover.

DGMGRL> switchover to prod1
Performing switchover NOW, please wait...
Error: ORA-16775: target standby database in broker operation has potential data loss

Failed.
Unable to switchover, primary database is still "sbdb1"

进一步查询归档传输情况,发现最新的几个归档都没有传输成功,此时alert还没有报错,但可以通过查询v$archive_dest确认错误信息:

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

ERROR
-----------------------------------------------------------------
ORA-00088: command cannot be executed by shared server

错误的提示非常明确了,再看下oerr的帮助:

$ oerr ora 88
00088, 00000, "command cannot be executed by shared server "
// *Cause:  Debug command issued on shared server.
// *Action: Reissue the command using a dedicated server.

问题明确了,处理起来也非常简单,进一步检查发现tnsnames.ora中的配置没有显示指定(SERVER = DEDICATED),而恰好数据库配置了共享连接。所以我们只需要修改显示指定(SERVER = DEDICATED)即可,例如这样:

PROD1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = xxx01.example.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)      --这里显示指定
      (SERVICE_NAME = PROD1.us.oracle.com)
    )
  )

注意主备库都需要同步修改,修改完成后,没有再进行任何操作,就可以看到之前没有传输的归档自动传输成功。
此时再次进行switchover切换测试就可以成功了。