ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORA-12541: TNS:no listener (DBD ERROR: OCIServerAttach) (转)

ORA-12541: TNS:no listener (DBD ERROR: OCIServerAttach) (转)

原创 Linux操作系统 作者:sxp03 时间:2011-09-26 09:37:00 0 删除 编辑
有一次,装完数据库后,并配置好监听,当使用SQL*PLUS,PL/SQL DEVELOPER工具登录都没有问题,但是使用OEM管理界面的时候就报错了,下面是我的整个排错过程,

1)检查告警日志(alert_SID.log)

仔细看了下日志,没有相关的报警信息,同时也查看了listener.ora的文件,连接也正常

2)检查监听文件

由于用其它工具可以连接,首先当时我没有怀疑监听的问题,我记得当时建监听文件是从正式库运行的拷贝过来的,启动完监听后,信息如下:

lsnrctl stat

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-DEC-2010 10:25:27

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.100.99)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                06-DEC-2010 10:18:17
Uptime                    0 days 0 hr. 7 min. 10 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/db10g/network/admin/listener.ora
Listener Log File         /u01/app/oracle/db10g/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=df2)(PORT=1521)))
Services Summary...
Service "df2" has 2 instance(s).
  Instance "df2", status UNKNOWN, has 1 handler(s) for this service...

当时就怀疑这个监听有点怪,后面经开发人员反映也没有什么问题,就一直没有去理会,经过二个星期,由于使用oracle 10g OEM的功能进行数据库的监听就出现了上述的问题

3)启用oem

emctl start dbconsole  --正常

4)浏览http://10.10.100.99:1158/em/   就出现了访问不了,提示是监听的问题

5)后面根据网上的一些方法,说是listener.ora和tnsnames.ora文件的配置问题,不过我仔细看了下IP,PORT,ORACLE_HOME,没有什么问题,苦苦想了很久,从报错的信息来看,还是监听的问题,然后使用netca重新进行了配置,发现用lsnrctl stat终于有了不一样的变化了,如下:

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-DEC-2010 10:25:27

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.100.99)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                06-DEC-2010 10:18:17
Uptime                    0 days 0 hr. 7 min. 10 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/db10g/network/admin/listener.ora
Listener Log File         /u01/app/oracle/db10g/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=df2)(PORT=1521)))
Services Summary...
Service "df2" has 2 instance(s).
  Instance "df2", status UNKNOWN, has 1 handler(s) for this service...
  Instance "df2", status READY, has 1 handler(s) for this service...
Service "df2XDB" has 1 instance(s).
  Instance "df2", status READY, has 1 handler(s) for this service...
Service "df2_XPT" has 1 instance(s).
  Instance "df2", status READY, has 1 handler(s) for this service...
The command completed successfully

就像看到了久违的老朋友一样,让我欢喜万分,马上打开浏览器,输入地址一看,错误消失,监控浏览正常

 

 

总结:

导致这个问题的最终原因,是listener.ora配置的问题,后面进行了前后的listener.ora对比:

出错前:

# listener.ora Network Configuration File: /u01/app/oracle/db10g/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = df2)
      (ORACLE_HOME = /u01/app/oracle/db10g)
      (SID_NAME = df2)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.100.99)(PORT = 1521))
  )

解决后:

# listener.ora Network Configuration File: /u01/app/oracle/db10g/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = df2)
      (ORACLE_HOME = /u01/app/oracle/db10g)
      (SID_NAME = df2)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.100.99)(PORT = 1521))
    )
  )
标示红色的地方是有点不同,我后面想了下,由于之前是手工配置的文件,而且进行了修改,是标点符号误差原因造成,所以一定要谨慎监听文件的配置,为什么开发人员可以使用呢?看之前的监听状态,有一个是unkown的,意思是说监听是静态注册的,因此都可以使用,但OEM会调用相关的ORACLE内部的一些服务就最后失败了

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

请登录后发表评论 登录
全部评论

注册时间:2008-03-07

  • 博文量
    32
  • 访问量
    119733