天天看點

Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...,有需要的朋友可以參考下。

今天将伺服器的監聽程式重新開機了一下,重新開機後成功,但是資料庫死活注冊不上去,導緻用戶端沒法連接配接到資料庫:

<span style="font-family: Arial, Helvetica, sans-serif;">-- 啟動監聽
[[email protected] 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
[[email protected] 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.      

執行個體已經注冊,再來看看監聽狀态: 

[[email protected] 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
[[email protected] 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... ),檢視監聽配置是否有問題 

--監聽檔案的内容
[[email protected] admin]$ pwd
/u01/app/oracle/network/admin
[[email protected] 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      

監聽檔案貌似沒有問題,因為我之前是沒有問題,看看前面監聽的日志: 

[[email protected] 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檔案 

[[email protected] oracle]# hostname
localhost.localdomain

[[email protected] 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 ,可能這種情況導緻監聽無法解析導緻資料庫不能注冊到監聽程式中 

[[email protected] 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      

然後再重新開機監聽程式 

[[email protected] 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,到此,用戶端已經可以連接配接到資料庫了

繼續閱讀