1. 今天在连接oracle时,发现客户端始终不能连接,但客户端却能ping
[root@asm ~]# ping 192.168.1.111 PING 192.168.1.111 (192.168.1.111) 56(84) bytes of data. 64 bytes from 192.168.1.111: icmp_seq=1 ttl=64 time=2.79 ms 64 bytes from 192.168.1.111: icmp_seq=2 ttl=64 time=0.227 ms 64 bytes from 192.168.1.111: icmp_seq=3 ttl=64 time=0.342 ms --- 192.168.1.111 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 0.227/1.120/2.792/1.183 ms
2. 检查服务器监听器状态
[oracle@asm admin]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-APR-2014 10:05:15 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=asm)(PORT=1521))) TNS-12535: TNS:operation timed out TNS-12560: TNS:protocol adapter error TNS-00505: Operation timed out
(注,我的客户端(192.168.1.110)和服务端(192.168.1.111)都为虚拟机,客户端的虚拟机从服务端复制而来,故,它们两个主机名相同,但ip不同)
3. 查看服务端/etc/hosts文件
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 192.168.10.111 asm
发现服务端的ip居然为192.168.10.111而不是192.168.1.111,怪不得客户端不能连接服务端,居然这样修改/etc/hosts内容为
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 192.168.1.111 asm4. 重启服务端监听器
[oracle@asm admin]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-APR-2014 10:06:48 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=asm)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 26-APR-2014 09:23:39 Uptime 0 days 0 hr. 43 min. 8 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/product/db/network/admin/listener.ora Listener Log File /u01/app/diag/tnslsnr/asm/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=asm)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM", status READY, has 1 handler(s) for this service... Service "ORCL" has 2 instance(s). Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service... 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
至些完美解决问题