ITPub博客

首页 > Linux操作系统 > Linux操作系统 > TNS-1254 TNS-12560 TNS-00511 Linux Error: 111 【转载】

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

原创 Linux操作系统 作者:genweihua 时间:2012-12-19 16:15:40 0 删除 编辑
    这次安装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博客 ” ,链接:https://blog.itpub.net/22275400/viewspace-751360/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
事了拂衣去,深藏功与名!

注册时间:2009-08-28

  • 博文量
    114
  • 访问量
    623642