TNS-1254 TNS-12560 TNS-00511 Linux Error: 111 【转载】

    这次安装oracle数据库,遇到了不少麻烦,在网上搜集了资料,放在这里,作为解决问题的办法,留个纪念,作为参考。
网址:
http://blog.csdn.net/reda0821/article/details/7821007
http://cbcman.blog.163.com/blog/static/64816431201273559634/

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

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

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

数据库链接失败..

打开sqlplus 链接一切正常..

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

于是netstat查看端口

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

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

于是

  1. iptables -I INPUT -p tcp --dport 1521 -j ACCEPT  
  2. iptables -I FORWARD -p tcp --dport 1521 -j ACCEPT   

开放1521端口,再试..

仍然不行...

查看下oracle监听服务:

  1. lsnrctl status  
结果如下:
  1. LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 01-AUG-2012 16:07:46  
  2.   
  3. Copyright (c) 1991, 2011, Oracle.  All rights reserved.  
  4.   
  5. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))  
  6. TNS-12541: TNS:no listener  
  7.  TNS-12560: TNS:protocol adapter error  
  8.   TNS-00511: No listener  
  9.    Linux Error: 111: Connection refused  
  10. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=wodeoraclefuwuqi)(PORT=1521)))  
  11. TNS-12541: TNS:no listener  
  12.  TNS-12560: TNS:protocol adapter error  
  13.   TNS-00511: No listener  
  14.    Linux Error: 111: Connection refused  

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

  1. 127.0.0.1       localhost.localdomain   localhost  

删掉了,重新加上, 然后
  1. lsnrctl start  

之后
  1. lsnrctl status  
结果如下:
  1. LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 01-AUG-2012 16:11:35  
  2.   
  3. Copyright (c) 1991, 2011, Oracle.  All rights reserved.  
  4.   
  5. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))  
  6. STATUS of the LISTENER  
  7. ------------------------  
  8. Alias                     LISTENER  
  9. Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production  
  10. Start Date                01-AUG-2012 16:11:27  
  11. Uptime                    0 days 0 hr. 0 min. 8 sec  
  12. Trace Level               off  
  13. Security                  ON: Local OS Authentication  
  14. SNMP                      OFF  
  15. Default Service           XE  
  16. Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora  
  17. Listener Log File         /u01/app/oracle/diag/tnslsnr/sstdevel/listener/alert/log.xml  
  18. Listening Endpoints Summary...  
  19.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))  
  20.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wodeoraclefuwuqi)(PORT=1521)))  
  21. Services Summary...  
  22. Service "PLSExtProc" has 1 instance(s).  
  23.   Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...  
  24. The command completed successfully  
重新进入rails目录 rake db:migrate 搞定!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22275400/viewspace-751360/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22275400/viewspace-751360/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值