转载自:http://www.cnblogs.com/kerrycode/archive/2012/12/14/2818421.html

在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 statusLSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-DEC-2012 15:51:13Copyright (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.79TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 14-12月-2012 15:47:15Copyright (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文件:
直接改iptables配置就可以了:vim /etc/sysconfig/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连接数据库,问题解决。

ORA-12170:TNS:连接超时相关推荐

  1. 一次“ora-12170 tns 连接超时”的经历

    win7    64位系统 oracle  10g   64位 plsql之前连接是好使的,突然连接不上,提示错误"ora-12170 tns 连接超时" 1.ping IP    ...

  2. 关于ORA-12170 tns 连接超时等一系列Oracle无法正常登入问题

    文章转载来自于:https://blog.csdn.net/qq_40707682/article/details/81667918 由于该篇文章成功解决了我的问题,所以记录一下,方便后面的小伙伴们学 ...

  3. 远程使用plsql登陆数据库时,界面提示 ORA-12170 TNS 连接超时

    本机正常使用,但是局域网中的其他机器出现"ORA-12170:TNS:连接超时 解决方法: 查看网络能否ping通 ping ip地址 tnsping ip地址(或者是服务器的实例名SID) ...

  4. 0ra-12170 tns 连接超时

    大家好: 前几天在机房连接数据库服务器时,报了"0ra-12170  tns 连接超时".这个错误费了我两天的时间才把问题解决掉,现在总结下,希望大家少走些弯路 从错误的信息上看, ...

  5. 基于ORA-12170 TNS 连接超时解决办法详解

    1.开始----程序-----oracle------配置和移植工具-----Net Manager----本地----服务命名---ora11(这个是我的专用服务器) 把右边下面的主机名改成192. ...

  6. 连oracle报错ora-12170,基于ORA-12170 TNS 连接超时解决办法详解

    1.开始----程序-----oracle------配置和移植工具-----Net Manager----本地----服务命名---ora11(这个是我的专用服务器) 把右边下面的主机名改成192. ...

  7. tns 连接超时_ORA-12170:TNS:连接超时

    本文转自 http://www.cnblogs.com/kerrycode/archive/2012/12/14/2818421.html 1:首先检查网络是否能ping通 2:检查TNS配置(TNS ...

  8. oracle tns测试,在客户端配置TNS测试报错ORA-12170:TNS:连接超时

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

  9. ORA-12170:TNS:连接超时错误处理

    一.问题描述 在使用sqldeveloper登录数据库时,有如下报错: 二.原因定位 查看防火墙状态: # firewall-cmd --state running 当前防火墙处于开启状态 三.处理方 ...

  10. oracle连接超时 时好时坏,关于Oracle连接超时的问题

    测试环境ORACLE 11.2.0. 如果连接池设置单个连接闲置时间大于数据库连接超时时间,则连接池中的连接发出数据请求时会出现Connect timeout occurred错误, 这是由于连接超时 ...

最新文章

  1. python中可以表示任意大的整数_Python无法表示99999999999999999999这样大的整数。
  2. dj鲜生-11-优化url-合并视图函数
  3. I/O设备的基本概念和分类
  4. 关于数组表示的二叉结构中,下标乘除法对应关系的理解
  5. luoguP4705 玩游戏
  6. System Security Services Daemon(SSSD)系统安全服务守护进程
  7. python3: failed with error code 1 in /tmp/pip-build-qp5puacl/Pillow/
  8. BUUCTF misc 专题(77)间谍启示录
  9. 用户画像 客户消费模型表
  10. Mac 环境endnote 各种问题解决方法和word各种技巧汇总
  11. Vfed大橙子模板 苹果cms自动采集 的方法
  12. 基于Gensim创建词向量
  13. 微信怎么彻底删除微信消息?
  14. ros 发布信息频率_ROS:消息发布器和订阅器(c++)
  15. 浙江有计算机学校吗,浙江2021年哪里有计算机学校
  16. Java反射机制的学习(3)
  17. VMware Horizon 8 2111 部署系列(十三)创建应用程序池
  18. 金蝶云星空套打模板选横向打印输出仍是竖向解决方法
  19. 运 算 符 和 表 达式
  20. Qt串口通信-qextserialport

热门文章

  1. java json jar包_jsonobject jar包下载
  2. React Hook “useState“ is called in function xx which is neither a React function component or
  3. java获取数据库数据保存到本地txt文件中
  4. frame框架点击链接或者按钮跳转整个页面以及别的frame框架
  5. 三维重建:SLAM的粒度和工程化问题
  6. Greenplum table 之 外部表
  7. MyBatis源码分析-2-基础支持层-反射模块-TypeParameterResolver/ObjectFactory
  8. cas实现单点登录原理
  9. Python之IPython开发实践
  10. Cubieboard:享誉国外 Linux 圈子的中国产品