00511 Linux Error: 111 解决方法

今天在做ORACLE数据库和torquebox的连接

在配置好driver之后 rake的时候发现如下异常:

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection>

数据库链接失败..

打开sqlplus 链接一切正常..

反复修改database.yaml后,仍然报错。

于是netstat查看端口

发现列表中并没有1521端口。

可能是防火墙把端口屏蔽掉了

于是

iptables -I INPUT -p tcp –dport 1521 -j ACCEPTiptables -I FORWARD -p tcp –dport 1521 -j ACCEPT 开放1521端口,再试..

仍然不行…

查看下oracle监听服务:

lsnrctl status结果如下:LSNRCTL for Linux: Version 11.2.0.2.0 – Production on 01-AUG-2012 16:07:46Copyright (c) 1991, 2011, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refusedConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=wodeoraclefuwuqi)(PORT=1521)))TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refused

找到问题原因了,上网google,发现这个问题和IP有关系,,之前在调整apache虚拟服务器的时候,为了测试把/etc/hosts里的这一行:

127.0.0.1localhost.localdomain localhost删掉了,重新加上, 然后lsnrctl start之后lsnrctl status结果如下:LSNRCTL for Linux: Version 11.2.0.2.0 – Production on 01-AUG-2012 16:11:35Copyright (c) 1991, 2011, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))STATUS of the LISTENER————————AliasLISTENERVersionTNSLSNR for Linux: Version 11.2.0.2.0 – ProductionStart Date01-AUG-2012 16:11:27Uptime0 days 0 hr. 0 min. 8 secTrace LeveloffSecurityON: Local OS AuthenticationSNMPOFFDefault ServiceXEListener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.oraListener Log File/u01/app/oracle/diag/tnslsnr/sstdevel/listener/alert/log.xmlListening Endpoints Summary… (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wodeoraclefuwuqi)(PORT=1521)))Services Summary…Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service…The command completed successfully重新进入rails目录 rake db:migrate 搞定!

黑夜下,撕开那张面具尽是怠倦的容颜,

00511 Linux Error: 111 解决方法

相关文章:

你感兴趣的文章:

标签云: