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

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连接数据库,问题解决。

ORA-12170:TNS:连接超时的更多相关文章

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

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

  2. ORA-12170: TNS: 连接超时

    ORA-12170: TNS: 连接超时 如果在本机可以正常使用,可是到局域网中的其他机器就出现“ORA-12170:TNS:连接超时 解决方法: 1.cmd-----ping ip地址 查看网络问题 ...

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

    转自原文 基于ORA-12170 TNS 连接超时解决办法详解 1.开始----程序-----Oracle------配置和移植工具-----Net Manager----本地----服务命名---o ...

  4. sql 查询 ORA-12170 TNS 连接超时特殊原因

    一般对于ORA-12170这个问题 1 看数据ip 是否能ping通 2 数据库服务是否启动 3 数据库服务所在服务器防火墙 然而当你能进去数据,而报这个这错时: 1 看代码中数据库连接是写错 2 如 ...

  5. PL/SQL连不上,报 ORA-12170:TNS 连接超时

    排错步骤: 1.查看网络是否通畅 打开cmd, ping 数据库IP 2. 查看端口是否通畅 打开cmd,tnsping 数据库IP 如果piing不通,可能是防火墙问题 3.检查防火墙状态 #ser ...

  6. 0ra-12170 tns 连接超时

    https://blog.csdn.net/zhaoxiangchong/article/details/8296980

  7. 修改tnsnames.ora文件中配置内容中的连接别名后,连接超时解决办法

    1.tnsnames.ora文件中配置内容中的连接别名:由upaydb修改为IP地址 2.连接超时 定位原因: PLSQL登录界面的数据库列表就是读的tnsname.ora中连接的别名,这个文件中连接 ...

  8. Toad客户端连接Oracle数据库报错 ORA-12170:TNS:连接超时

    Oracle 客户端连接Oracle数据库报错   ORA-12170:TNS:连接超时  排错步骤: 1. 查看网络是否畅通:  打开cmd,ping数据库IP 2. 查看端口是否畅通: 打开cmd ...

  9. 关于Oracle连接超时的问题

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

随机推荐

  1. webView文本长按显示英文

    webView文本长按显示英文时,在info.plist文件中添加如下内容: <key>CFBundleLocalizations</key> <array> &l ...

  2. 【UML】UML基础知识

    UML简介     统一建模语言(UML)是一个通用的可视化建模语言,用于对软件进行描述.可视化处理.构造和建立软件系统制品的文档.     它记录了对必须构造的系统的决定和理解,可用于对系统的理解. ...

  3. Install wget for mac

    Download: http://ftp.gnu.org/gnu/wget/ Unpack: tar zxvf wget-1.16.tar Configuration: ./configure If ...

  4. 适合于小团队产品迭代的APP测试流程

    一.测试周期 测试周期一般为2~3天,根据项目情况以及版本质量可适当缩短或延长测试时间.正式测试前先向主管或产品经理确认项目排期. 二.测试资源 测试任务开始前,检查各项测试资源. 产品功能需求文档. ...

  5. JSP内置对象总结

    前几天学习了javaee中的jsp(Java Server Pages),即java服务器页面,其实就是在html里面写java代码. 一.概述前言 在总结九大对象之前,有必要先搞清楚几个概念:请求, ...

  6. Python学习笔记(1):列表元组结构

    Python的列表元组功能强大,令人印象深刻.一是非常灵活,二是便于集体操作.特别是以元组作为列表项的结构,和数据访问的结果能够对应起来,和习惯的二维表理解上也一致,有很多的用途. 以学习笔记(3)中 ...

  7. 【Android开发坑系列】之PopupWindow

    PopupWindow在4.0之前的版本有个系统级别的BUG,必须借助一段自定义的fix代码来修复.其中mPopPm就是PopupWindow实例.java.lang.NullPointerExcep ...

  8. PUT vs POST in REST

    来自:http://stackoverflow.com/questions/630453/put-vs-post-in-rest http://www.15yan.com/story/7dz6oXiS ...

  9. Road to the future——伪MVVM库Q.js

    模仿Vuejs的伪MVVM库,下面是使用说明 项目地址:https://github.com/miniflycn/Q.js 相关项目:https://github.com/miniflycn/Ques ...

  10. [CoreOS 转载] CoreOS实践指南(七):Docker容器管理服务

    转载:http://www.csdn.net/article/2015-02-11/2823925 摘要:当Docker还名不见经传的时候,CoreOS创始人Alex就预见了这个项目的价值,并将其做为 ...