今天新安装了一个oracle server,实例启动了,监听状态也正常。
[oracle@db ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 31-OCT-2013 13:02:45
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 31-OCT-2013 13:01:49
Uptime 0 days 0 hr. 0 min. 56 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_4/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/db/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db)(PORT=1521)))
Services Summary...
Service "urpdb" has 1 instance(s).
Instance "urpdb", status READY, has 1 handler(s) for this service...
Service "urpdbXDB" has 1 instance(s).
Instance "urpdb", status READY, has 1 handler(s) for this service...
The command completed successfully
通过pl/sql工具连接 ,提示 ora-12560 tns 协议适配器错误。
查询了网上的解决办法,基本监听问题、实例未启动等原因。
这些情况在我这里不存在;最后,想到可能是端口问题,于是在客户端 telnet db的IP 1521 不通。
这就说明可能是防火墙阻止了端口。
于是排查数据库服务器的防火墙状态:
[root@db ~]# /etc/init.d/iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
把防火墙关闭:
[root@db ~]# /etc/init.d/iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
问题解决。