DG搭建多次,没想到还是栽到坑里了。
备库使用RMAN恢复主库的全备追加归档方式搭建,当备库恢复到mount状态开始追加主库的归档时候,主库报错:
Thu Jul 13 00:02:15 2017
Error 12154 received logging on to the standby
Errors in file data/oracle/app/oracle/diag/rdbms/mposm/mposm/trace/mposm_arc2_49359.trc:
ORA-12154: TNS:could not resolve the connect identifier specified
PING[ARC2]: Heartbeat failed to connect to standby 'mposdg1'. Error is 12154.
Thu Jul 13 00:08:15 2017
Error 12154 received logging on to the standby
Errors in file data/oracle/app/oracle/diag/rdbms/mposm/mposm/trace/mposm_arc2_49359.trc:
ORA-12154: TNS:could not resolve the connect identifier specified
PING[ARC2]: Heartbeat failed to connect to standby 'mposdg1'. Error is 12154.
vi data/oracle/app/oracle/diag/rdbms/mposm/mposm/trace/mposm_arc2_49359.trc
*** 2017-07-13 00:02:15.937
Redo shipping client performing standby login
OCIServerAttach failed -1'
OCIServerAttach failed -1'
OCIServerAttach failed -1'
*** 2017-07-13 00:02:15.940 4132 krsh.c
Error 12154 connecting to destination LOG_ARCHIVE_DEST_3 standby host 'mposdg1'
Error 12154 attaching to destination LOG_ARCHIVE_DEST_3 standby host 'mposdg1'
PING[ARC2]: Heartbeat failed to connect to standby 'mposdg1'. Error is 12154.
*** 2017-07-13 00:02:15.941 2747 krsi.c
krsi_dst_fail: dest:3 err:12154 force:0 blast:1
看到这种报错,无非就是监听配置或者网络配置的问题。于是查看主备库的tnsnames.ora监听文件内容,并没发现任何问题
然后继续查看主库的监听状态正常
查看备库的监听状态正常
看似一切都正常,关键是tnsping mposm和tnsping mposdg1都正常
貌似网络是通的,但是!
不使用远程网络的登陆方式能正常登陆,一旦使用远程登陆就提示登陆拒绝!貌似还是网络的问题,网络不通。于是再次重新排查一遍网络,并未发现任何问题,tnsping都能通,但就是这个远程登陆过不去。
各种方法都尝试过后,无奈下将sys密码重新更改,奇迹出现了,远程连接主备库都正常了!至于为什么,至今没想明白......
重新将主库的传输归档路径激活,竟然还是报错!
vi /data/oracle/app/oracle/diag/rdbms/mposm/mposm/trace/mposm_arc2_49359.trc
OCIServerAttach failed -1
.. Detailed OCI error val is 12504 and errmsg is 'ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA'
*** 2017-07-13 10:52:32.061 4132 krsh.c
Error 12504 received logging on to the standby
*** 2017-07-13 10:52:32.061 869 krsu.c
Error 12504 connecting to destination LOG_ARCHIVE_DEST_2 standby host 'MPOSDG1'
Error 12504 attaching to destination LOG_ARCHIVE_DEST_2 standby host 'MPOSDG1'
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
*** 2017-07-13 10:52:32.061 4132 krsh.c
PING[ARC2]: Heartbeat failed to connect to standby 'MPOSDG1'. Error is 12504.
*** 2017-07-13 10:52:32.061 2747 krsi.c
krsi_dst_fail: dest:2 err:12504 force:0 blast:1
这次报错似乎又指向了网络问题,无法解析tnsnames文件中内容,问题是tnsnames文件写的并没有问题。
后经在mos查询,发现是11.2.0.1的一个BUG,对应的是ORA-12154刚开始的报错(文档 ID 1240558.1)。
由于主库不允许停机重启,所以将主库传输备库的归档路径中SERVICE设置成tnsnames文件中的连接标识串并再次激活路径状态。问题得到解决,主备连接恢复正常!