Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…

  • Post author:
  • Post category:其他


Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…,有需要的朋友可以参考下。


今天将服务器的监听程序重启了一下,重启后成功,但是数据库死活注册不上去,导致客户端没法连接到数据库:



<span style="font-family: Arial, Helvetica, sans-serif;">-- 启动监听
[oracle@localhost dbs]$ lsnrctl start</span>
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-FEB-2015 13:43:40

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

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@localhost dbs]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-FEB-2015 13:43:45

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                04-FEB-2015 13:43:21
Uptime                    0 days 0 hr. 0 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/network/admin/listener.ora
Listener Log File         /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.100)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


启动后,提示


Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…


这个提示一般认为很正常,是由于实例没有注册到监听服务中去,于是注册实例




SQL> alter system register;

System altered.





实例已经注册,再来看看监听状态:



[oracle@localhost dbs]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-FEB-2015 13:43:40

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

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@localhost dbs]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-FEB-2015 13:43:45

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                04-FEB-2015 13:43:21
Uptime                    0 days 0 hr. 0 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/network/admin/listener.ora
Listener Log File         /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.100)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully




发现orcl 还是未知状态(


Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…


),查看监听配置是否有问题




--监听文件的内容
[oracle@localhost admin]$ pwd
/u01/app/oracle/network/admin
[oracle@localhost admin]$ more listener.ora 
# listener.ora Network Configuration File: /u01/app/oracle/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = /u01/app/oracle)
      (PROGRAM = extproc)
    )
     (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /u01/app/oracle)
      (SID_NAME = orcl) 
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.3.100)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/app




监听文件貌似没有问题,因为我之前是没有问题,看看前面监听的日志:




[oracle@localhost admin]$ tail -30 /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
<msg time='2015-02-04T13:43:21.139+08:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='localhost.localdomain'
 host_addr='::1'>
 <txt>WARNING: Subscription for node down event still pending
 </txt>
</msg>
<msg time='2015-02-04T13:43:21.140+08:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='localhost.localdomain'
 host_addr='::1'>
 <txt>04-FEB-2015 13:43:21 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=localhost.localdomain)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=186647296)) * status * 0
 </txt>
</msg>
<msg time='2015-02-04T13:43:40.091+08:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='localhost.localdomain'
 host_addr='::1'>
 <txt>04-FEB-2015 13:43:40 * ping * 0
 </txt>
</msg>
<msg time='2015-02-04T13:43:45.083+08:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='localhost.localdomain'
 host_addr='::1'>
 <txt>WARNING: Subscription for node down event still pending
 </txt>
</msg>
<msg time='2015-02-04T13:43:45.084+08:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='localhost.localdomain'
 host_addr='::1'>
 <txt>04-FEB-2015 13:43:45 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=localhost.localdomain)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=186647296)) * status * 0
 </txt>


发现监听在启动时,读取了主机名:


localhost.localdomain


,个人感觉应该是主机名解析有问题,于是看看hosts文件




[root@localhost oracle]# hostname
localhost.localdomain

[root@localhost oracle]# more /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.3.100 localhost.localdomain


发现三个IP都对应了机器名localhost.localdomain ,可能这种情况导致监听无法解析导致数据库不能注册到监听程序中




[root@localhost oracle]# more /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
172.0.0.1   localhost
192.168.3.100 localhost.localdomain
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6




然后再重启监听程序




[oracle@localhost dbs]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-FEB-2015 15:10:10

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
LSNRCTL> start
Starting /u01/app/oracle/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/oracle/network/admin/listener.ora
Log messages written to /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.100)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                04-FEB-2015 15:10:29
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/network/admin/listener.ora
Listener Log File         /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.100)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>



实例注册后,再看看监听状态



LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                04-FEB-2015 15:10:29
Uptime                    0 days 0 hr. 1 min. 29 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/network/admin/listener.ora
Listener Log File         /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.100)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl.localdomain" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl11gXDB.localdomain" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully



发现实例已经处于ready状态了。


OK,到此,客户端已经可以连接到数据库了