红联Linux门户
Linux帮助

/etc/hosts错误配置,导致TNS-12535的解决办法

发布时间:2016-06-12 16:11:21来源:linux网站作者:Vimeo

最近在虚拟机上安装好oracle11g,然后将网卡模式从host -only模式切换到 桥接模式,OK。

网卡正常切换,IP也获取到了,但是忘记将/etc/hosts里面的文件修改回来,然后,看下面:

[oracle@normal ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 07-6月 -2016 13:08:46

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Starting /u01/app/product/11.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Log messages written to /u01/app/diag/tnslsnr/normal/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=normal)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation timed out


新开一个终端,查看:

[oracle@normal ~]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 07-6月 -2016 13:09:17

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation timed out


查看listener.log日志:

[oracle@normal trace]$ tail -f listener.log
Tue Jun 07 13:09:47 2016
Log messages written to /u01/app/diag/tnslsnr/normal/listener/alert/log.xml
Trace information written to /u01/app/diag/tnslsnr/normal/listener/trace/ora_2547_139732456363776.trc
Trace level is currently 0

Started with pid=2547
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=normal)(PORT=1521)))
Listener completed notification to CRS on start

TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE

卡在这里,不动!


仔细看上面的过程,发现HOST= 空,继而想到主机IP与hostname之间肯定存在问题。

然后找到hosts文件,一看,确实是因为现IP对应的主机名并不一致。

将ip与hostname配置一致,重启网卡后,listener正常。


本文永久更新地址:http://www.linuxdiyf.com/linux/21468.html