环境: 数据库服务器 linux rh4 +oracle 10.2.0.4
客户端:winxp sp2
连接数据库时报TNS-12560错误
C:\Documents and Settings\Paul Yi>tnsping asm
TNS Ping Utility for 32-bit Windows: Version 9.2.0.8.0 - Production on 07-JUL-20
08 09:45:01
Copyright (c) 1997, 2006, Oracle Corporation. All rights reserved.
Used parameter files:
D:\oracle\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.1.206)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =orcl)))
TNS-12560: TNS:protocol adapter error
实例采用静态注册 在服务器上运行正常
[oracle@localhost admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-JUL-2008 08:44:39
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.206)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 07-JUL-2008 08:40:31
Uptime 0 days 0 hr. 4 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/10.2/db/network/admin/listener.ora
Listener Log File /oracle/10.2/db/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.206)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost admin]$ tnsping asm
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 07-JUL-2008 08:56:12
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.206)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (10 msec)
[oracle@localhost admin]$
最后想到防火墙问题 把防火墙关闭后
[root@localhost ~]# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
C:\Documents and Settings\Paul Yi>tnsping asm
TNS Ping Utility for 32-bit Windows: Version 9.2.0.8.0 - Production on 07-JUL
08 09:52:13
Copyright (c) 1997, 2006, Oracle Corporation. All rights reserved.
Used parameter files:
D:\oracle\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = T
(HOST = 192.168.1.206)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =orcl)))
OK (0 msec)
正常 ,但想一下是通过默认端口1521访问的,所以允许访问服务器上的1521端口即可
vi /etc/sysconfig/iptables
将
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
改为
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1520:1523 -j ACCEPT
允许1520到1523的端口访问
[root@localhost ~]# service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7199859/viewspace-374281/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7199859/viewspace-374281/