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

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

(0)

相关推荐

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

    在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)) (CO

  • 解决springboot yml配置 logging.level 报错问题

    如下所示: logging: config: classpath:spring-logback.xml pattern: console: "%d - %msg%n" level: info 直接写 level: info 会报错: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'logging.level' to java.util.Map

  • 解决IDEA配置tomcat启动报错问题

    在配置servlet不同路径时遇上以下两个错误: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String:  java.lang.ClassNotFoundException: org.apache.jsp.index_jsp: 对于第一个问题,我上网查阅了很多资料后发现,可能是tomcat版本冲突导致,catalina log如下: 19-Feb-2018

  • 解决springboot项目不配置数据源启动报错问题

    目录 springboot项目不配置数据源启动报错 springboot配置双数据源报错 springboot项目不配置数据源启动报错 spring boot默认会加载 org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration 在启动类上加上 @SpringBootApplication(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoCo

  • springboot配置mysql数据库spring.datasource.url报错的解决

    目录 springboot配置mysql数据库spring.datasource.url报错 springboot下datasource连接配置 基本设置 datasource JPA jooq h2 JTA springboot配置mysql数据库spring.datasource.url报错 spring.datasource.url=jdbc:mysql://abc:3306/abcd?useUnicode=true&characterEncoding=utf8 很常规地配置了这个mysq

  • Swagger2配置方式(解决404报错)

    目录 Swagger2配置(解决404报错) 一.引入依赖 二.编写配置文件 三.解决404报错 swagger配置好后仍然404问题 Swagger2配置(解决404报错) 在spring boot项目中配置Swagger2,配置好了但是访问确实404,SwaggerConfig中的注入方法也执行了还是访问不到页面.究其原因是MVC没有找到swagger-ui包中的swagger-ui.html文件. Swagger2的配置步骤如下: 一.引入依赖 pom.wml <dependency>

  • vue-cli3.x配置全局的scss的时候报错问题及解决

    目录 vue-cli3配置全局scss报错 vue-cli3配置全局scss变量 1. 找到vue.config.js文件 2. 在文件内编写如下代码 3. 重启项目,即可使用 vue-cli3配置全局scss报错 在vue.config.js配置的时候用prependData不要用data sass: {   // 根据自己样式文件的位置调整 /旧版的scss-loader 是data 新版的是 prependData           prependData: `@import "@/st

  • 关于配置babel-plugin-import报错的坑及解决

    目录 配置babel-plugin-import报错的坑 问题 报错内容 错误原因 解决方案 babel-plugin-import配置babel按需引入antd模块报错.bezierEasingMixin() 解决方案 配置babel-plugin-import报错的坑 用的是antd design vue生成的项目,按着官网的提示一步一步下来,在配置babel-plugin-import时候发生了报错,一直找了很久没有解决问题 问题 项目可以正常运行,当配置babel-plugin-impo

  • 解决Python 写文件报错TypeError的问题

    处理上传的文件: f1 = request.FILES['pic'] fname = '%s/%s' % (settings.MEDIA_ROOT, f1.name) with open(fname, 'w') as pic: for c in f1.chunks(): pic.write(c) 测试报错: TypeError at /upload/ write() argument must be str, not bytes 把之前的打开语句修改为用二进制方式打开: f1 = request

  • 解决Jenkins集成SonarQube遇到的报错问题

    Jenkins集成Sonar过程中遇到的报错 1.jenkins中无法添加sonarqube的token凭证 因为添加的凭证类型错误,所以无法添加token,类型应该选择"Secret text",而不是"username with password". 2.启动sonarqube报错 #完整报错: ERROR: [1] bootstrap checks failed. You must address the points described in the fol

随机推荐