ORA-12170:TNS:连接超时
轉(zhuǎn)載自:http://www.cnblogs.com/kerrycode/archive/2012/12/14/2818421.html
在Red Hat Enterprise Linux Server Releae 5.5 成功安裝ORACLE 10g 后,在客戶端配置TNS后,測試是否可以連接到數(shù)據(jù)塊服務器,結(jié)果報錯: ORA-12170:TNS:連接超時
1:首先檢查網(wǎng)絡(luò)是否能ping通,如下所示,網(wǎng)絡(luò)是暢通的。
2:檢查TNS配置(TNS配置也沒有問題)
GSP = (DESCRIPTION = (ADDRESS =(PROTOCOL = TCP)(HOST = 172.20.36.79)(PORT = 1521)) (CONNECT_DATA= (SERVER = DEDICATED) (SERVICE_NAME = gsp) ) )3:查看服務器監(jiān)聽服務是否啟動
[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 successfully4:使用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.已使用的參數(shù)文件: 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:關(guān)閉防火墻(這種方案不怎么好,關(guān)閉防火墻,會帶來許多安全隱患)
[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記錄。
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 保存新增的規(guī)則,以免下次重啟機器后,配置規(guī)則失效
[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連接數(shù)據(jù)庫,問題解決。
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的ORA-12170:TNS:连接超时的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Oracle处理小数点后位数、格式化数字
- 下一篇: oracle服务器重启后监听启动