早上起来,研发人员告诉我,数据库无法连接了,我进入数据库查看监听状态
[oracle@lzdb2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-JAN-2015 09:14:50
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lzdb2)(PORT=1521)))
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
发现监听异常,度娘上找了这个问题,发现度娘上的错误,服务器上都没有那些问题,比如什么/etc/hosts下面的127.0.0.1 对应的localhost等,日志文件也未满2G。
突然想到,这个错误就是网络问题
查看网卡配置
# vim /etc/sysconfig/network-scripts/ifcfg-eth2
DNS1=202.98.192.67
发现里面有DNS,想起来了,原来是外部防火墙已经将数据库屏蔽,使数据库无法上网,也就是无法ping通202.98.192.67
将DNS1这条取消掉,重启网卡,查看监听状态
[oracle@lzdb2 log]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-JAN-2015 09:48:58
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lzdb2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 08-DEC-2014 10:36:01
Uptime 45 days 23 hr. 12 min. 57 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.2/dbhome/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/lzdb2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lzdb2)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
监听已正常,使用客户端工具连接正常
总结:当有网卡有DNS配置时,数据库不能连接到DNS导致监听出错,取消掉DNS,重启网卡,监听正常