在客户端配置TNS测试报错ORA-12170:TNS:连接超时_oracle

在Red Hat Enterprise Linux Server Releae 5.5 成功安装ORACLE 10g 后,在客户端配置TNS后,测试是否可以连接到数据块服务器,结果报错: ORA-12170:TNS:连接超时

1:首先检查网络是否能ping通,如下所示,网络是畅通的

2:检查TNS配置(TNS配置也没有问题)
GSP =
(DESCRIPTION =
(ADDRESS =(PROTOCOL = TCP)(HOST = 172.20.36.79)(PORT = 1521))
(CONNECT_DATA=
(SERVER = DEDICATED)
(SERVICE_NAME = gsp)
)
)

3:查看服务器监听服务是否启动
[oracle@wgods ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-DEC-2012 15:51:13
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 14-DEC-2012 13:15:28
Uptime 0 days 2 hr. 35 min. 45 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /database/oracle/product/dbhome/network/admin/listener.ora
Listener Log File /database/oracle/product/dbhome/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wgods)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "gsp" has 2 instance(s).
Instance "gsp", status UNKNOWN, has 1 handler(s) for this service...
Instance "gsp", status READY, has 1 handler(s) for this service...
Service "gspXDB" has 1 instance(s).
Instance "gsp", status READY, has 1 handler(s) for this service...
Service "gsp_XPT" has 1 instance(s).
Instance "gsp", status READY, has 1 handler(s) for this service...
The command completed successfully

4:使用tnsping命令检查,报TNS-12535: TNS: 操作超时,这时我们可以肯定是防火墙的问题了
C:\Users\kerry>tnsping 172.20.32.79
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 14-12月-2012 15:47:15
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
E:\app\kerry\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
已使用 EZCONNECT 适配器来解析别名
尝试连接 (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=172.20.32.79)(PORT=1521)))
TNS-12535: TNS: 操作超时
对于防火墙问题,我们可以有两种解决方案
1:关闭防火墙(这种方案不怎么好,关闭防火墙,会带来许多安全隐患)
[root@wgods ~]# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]

2:修改iptables,开放1521端口,允许1521端口被连接
2.1 编辑iptables文件,添加-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT记录。
[root@wgods sysconfig]# vi iptables
# Generated by iptables-save v1.3.5 on Fri Dec 14 17:03:58 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1749:243629]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 23 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Fri Dec 14 17:03:58 2012
~
~
~
~
~
"iptables" 24L, 1212C written

2.2 重启iptables服务
[root@wgods sysconfig]# service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_netbios_ns ip_conntrack_ftp [ OK ]
2.3 保存新增的规则,以免下次重启机器后,配置规则失效
[root@wgods sysconfig]# service iptables save
Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
2.4 查看1521端口是否开放,允许连接(见红色部分)
[root@wgods sysconfig]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:21
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:25
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:23
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:1521
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
[root@wgods sysconfig]#
从客户端用PL/SQL Developer连接数据库,问题解决。

时间: 2024-09-14 22:38:59

在客户端配置TNS测试报错ORA-12170:TNS:连接超时_oracle的相关文章

spring配置多数据源t junit测试报错

问题描述 spring配置多数据源t junit测试报错 Error creating bean with name 'seentao.workflow.engine.EngineTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: publi

xml-WCF 向客户端返回XML数据格式报错,请大神赐教“”超出最大字符串内容长度配额(8192)“”

问题描述 WCF 向客户端返回XML数据格式报错,请大神赐教""超出最大字符串内容长度配额(8192)"" !服务端配置 客户端配置 服务端返回客户端XML数据报错提示 解决方案 http://blog.csdn.net/yang_5/article/details/11775819

spring4.14+hibernate4.3整合,web运行正常,junit测试报错;

问题描述 spring4.14+hibernate4.3整合,web运行正常,junit测试报错: 之前web启动的时候也报这个错误,然后在web.xml里面加了这个filter,就好了. 可是现在用junit测试,没办法读取web.xml里面的配置,所以还报了这个错, 别问我为什么要junit测试,就是想知道 junit测试的时候这种情况怎么解决. 下面附代码 SpringOpenSessionInViewFilterorg.springframework.orm.hibernate4.sup

mac mysql-Mac上安装MySQL之后,连接测试报错

问题描述 Mac上安装MySQL之后,连接测试报错 不能连接到127.0.0.1(61)求教怎么解决.昨天弄了一宿都没弄好,不知道该怎么配置.求教大神. 解决方案 http://blog.sina.cn/dpool/blog/s/blog_9ea3a4b70101ihl3.html? 解决方案二: phpMyAdmim和Yii 连接Mysql报错.MySql连接报错1045 解决方案三: 楼主解决了么?我也是这个问题,用桌面客户端连接不行,换了2个了,都是这样..用终端我试过是可以创库创表的

spring rmi 配置 registryHost 启动报错

问题描述 spring rmi 配置 registryHost 启动报错 spring rmi 配置 registryHost 启动报错 Connection refused to host 不配置正常启动 服务端多ip 客户端无法调用

iis8-windows8.1 IIS8配置应用程序报错

问题描述 windows8.1 IIS8配置应用程序报错 windows8.1 IIS8配置应用程序,打开网站是提示 如下: 尝试读取或写入受保护的内存.这通常指示其他内存已损坏. 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息. 异常详细信息: System.AccessViolationException: 尝试读取或写入受保护的内存.这通常指示其他内存已损坏. 源错误: 执行当前 Web 请求期间生成了未经处理

泸州属南气矿----配置S2600磁盘阵列报错:There is no master controller.

问题现象:   配置S2600磁盘阵列报错:There is no master controller.   Please input the array controller A IP address: 192.168.8.39 Please input the array controller B IP address: 192.168.8.40   ***** Error: There is no master controller.    = OK: install expectpkg 

junit测试报错,求大神救命,控制台输出如下,

问题描述 junit测试报错,求大神救命,控制台输出如下, 0 2015-07-09 09:04:52182 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - #org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:316)# -

java-junit 4 测试报错,求大神救命,控制台输出如下

问题描述 junit 4 测试报错,求大神救命,控制台输出如下 求大神解救! 解决方案 jar版本不对 ,导致没找到对应的方法.或者导入的jar不对