环境为
操作系统:AIX 6.1
oracle版本:11.2.0.3 (psu5)
本编记录了本人一次DG搭建失败的经历,只是一个小的错误,但却导致我排查了半天。记录本次经历用来警醒自己,作为一名dba任何时候我们都要万分仔细,认真。
DG搭建的具体步骤此处就省略了,后面有时间会写一遍详细的DG搭建步骤及检查方法。
按正常的步骤部署完成,用rman duplicate方式完成备库的复制后进行如下操作:
1.在备库上启动恢复管理模式
SQL> recover managed standby database using current logfile disconnect;
2.在主库查看当前日志
SQL> select * from v$log;
主库强制归档
SQL> alter system archive log current; (多切几次)
System altered.
3.在备库查看新的归档日志有没有正常传输过来,并被应用
select THREAD#,SEQUENCE#,ARCHIVED,APPLIED,DELETED,STATUS from v$archived_log;
--查看发现新切换的日志没有被传送过来,但是在主备机上下面四项的检查都是通过的(egap和egapdb分别为主被库的连接字符串)
tnsping egap
tnsping egapdb1
sqlplus sys/oracle@egap as sysdba
sqlplus sys/oracle@egapdb as sysdba
查看了备库的alert日志
报错信息如下:
Wed Mar 19 18:10:32 2014 Time drift detected. Please check VKTM trace file for more details. Wed Mar 19 19:11:11 2014 Time drift detected. Please check VKTM trace file for more details. Wed Mar 19 20:23:42 2014 Time drift detected. Please check VKTM trace file for more details.
查询了mos上相关文档,说是11g的一个bug,但是跟我的问题好像无关,先跳过。
接着查看主库的alert日志
Wed Mar 19 21:32:52 2014 Error 12154 received logging on to the standby FAL[server, ARC0]: Error 12154 creating remote archivelog file 'egapdg' FAL[server, ARC0]: FAL archive failed, see trace file. ARCH: FAL archive failed. Archiver continuing ORACLE Instance egap - Archival Error. Archiver continuing. ALTER SYSTEM ARCHIVE LOG
根据主库alert日志里的信息又查看了vi egap_arc0_26345742.trc(arc0 的trace日志,在alert同级目录下 ls �Clrt 查看最近的arc0 的trace日志)
Redo shipping client performing standby login OCIServerAttach failed -1 .. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified ' OCIServerAttach failed -1 .. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified ' OCIServerAttach failed -1 .. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified ' *** 2014-03-19 21:32:52.054 4320 krsh.c Error 12154 received logging on to the standby *** 2014-03-19 21:32:52.054 915 krsu.c Error 12154 connecting to destination LOG_ARCHIVE_DEST_2 standby host 'egapdg' Error 12154 attaching to destination LOG_ARCHIVE_DEST_2 standby host 'egapdg' *** 2014-03-19 21:32:52.054 2932 krsi.c krsi_dst_fail: dest:2 err:12154 force:0 blast:1 kcrrwkx: unknown error:12154
我们也可以用select error from v$archive_dest where target='STANDBY'来快速查看DG的报错信息
根据主库的alert日志以及arc0的trace日志,基本可以肯定是链接串或者监听的问题了,于是我左一遍又一遍的排查,监听配置,tnsnames文件配置,密码文件配置。但是都没有发现问题。最后下班回家以后又仔细排查了一遍,终于发现是主库的log_archive_dest_2参数中 指定的字符串中写错了一个字母。
更改后,DG正常!!!
打错一个字母很容易,但是排查起来我们可能就要耗费莫大的人力和精力。
“胆大!!!心细!!!”