Oracle案例04——TNS-12547: TNS:lost contact
Oracle数据库服务器DG从库重启后,无法完成数据同步,具体报错信息如下:
一、报错信息
alter log报错
*********************************************************************** Fatal NI connect error 12547, connecting to: VERSION INFORMATION: TNS for Linux: Version 11.2.0.3.0 - Production TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.3.0 - Production Time: 23-APR-2018 10:30:45 Tracing not turned on. Tns error struct: ns main err code: 12547 TNS-12547: TNS:lost contact ns secondary err code: 12560 nt main err code: 517 TNS-00517: Lost contact nt secondary err code: 104 nt OS err code: 0 Error 12547 received logging on to the standby FAL[client, USER]: Error 12547 connecting to LOGDB for fetching gap sequence
二、错误原因分析
根据报错信息可以看到通过tns连接logdb服务名存在问题,可通过排查监听是否启动,是否有防火墙限制等。
三、处理步骤
通过排查监听和防火墙限制,发现没有问题,主库通过tns服务名连接正常,从库通过tnsping报错
[oracle@dg ~]$ tnsping logdb TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 23-APR-2018 11:26:28 Copyright (c) 1997, 2011, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 1xx.xx.xx.xx)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = logdb))) TNS-12547: TNS:lost contact
从库通过telnet 主库IPaddr 1521端口检查,发现连接上后直接被关闭
# telnet 1xx.xx.xx.xx 1521 Trying 1xx.xx.xx.xx... Connected to 1xx.xx.xx.xx. Escape character is '^]'. Connection closed by foreign host.
这里基本可以断定是监听问题,具体检查后发现只sqlnet.ora做了监听限制
tcp.validnode_checking=yes tcp.invited_nodes=(ip1,ip2,ip3,ip4,ip5,ip6)
将备库IP添加进允许访问列表即可,然后通过tnsping检查连接正常,然后通过手动恢复主备同步。
(DG主备同步恢复过程略)