因為/etc/hosts中問題導致監聽掛起-報錯:WARNING: Subscription for node down event still pending

還不算暈發表於2013-11-18
問題描述:監聽重啟後稍等(大約一分鐘後)檢查監聽狀態,監聽已經報錯: 
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
-----其實上面這種報錯就是監聽沒啟動--至於未啟動的原因,可能是程式確實未啟動或程式被KILL、掛起等各種原因總之是程式沒啟動。
 檢查日誌發現有一條資訊:WARNING: Subscription for node down event still pending
搜尋此條報錯的資訊,網上解答大致兩種情況是:
情況一:Oracle 顯示該問題為bug,並在10.2.0.3中已修復,但是在11.1.0.6中仍然存在。
情況二:監聽無法在指定埠啟動--可能前一次監聽未正常退出或有其它程式佔用了埠
但是回想此前監聽程式一直執行正常,也檢視了埠無異常。報著有錯誤先從自身查起的心態,回憶了最近對系統做過的所有變更。
從修改監聽配置檔案listener.ora、tnsnames.ora、動態監聽的註冊都檢查了多遍。重建了多次監聽均無法解決此故障。
終於想起了修改過/etc/hosts中的資訊,於是重新修改此檔案,將127.0.0.1條目恢復為系統預設的:127.0.0.1       localhost.localdomain localhost。重啟監聽正常
下面重現一下此錯誤的產生和解決。
#########################################################################################################################
實驗思路說明:    --一些無意義的輸出就省略了未貼出。可以直接在文章左上的文章名下目錄檢視需要的小節。
實驗一是正確配置/etc/hosts及監聽正常執行的狀態;
實驗二模擬出錯的場景為修改127.0.0.1 bys3.bys.com bys3,增加192.168.1.211   bys3.bys.com ,並分別修改listener.ora的三小步。
實驗三模擬出錯的場景為修改127.0.0.1 bys3.bys.com bys3,但是刪除192.168.1.211   bys3.bys.com    bys3條目。使用DBCA預設建立的listener.ora
#########################################################################################################################

實驗一:將/etc/hosts中127.0.0.1條目設定為預設的:       

127.0.0.1       localhost.localdomain localhost;192.168.1.211   bys3.bys.com    bys3條目依然保留。
重新啟動監聽可以正常。

[root@bys3 ~]# cat /etc/hosts
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.1.211   bys3.bys.com    bys3
[root@bys3 ~]# ping bys3
PING bys3.bys.com (192.168.1.211) 56(84) bytes of data.
64 bytes from bys3.bys.com (192.168.1.211): icmp_seq=1 ttl=64 time=0.232 ms
^C
--- bys3.bys.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.232/0.232/0.232/0.000 ms
[root@bys3 ~]# ping bys3.bys.com
PING bys3.bys.com (192.168.1.211) 56(84) bytes of data.
64 bytes from bys3.bys.com (192.168.1.211): icmp_seq=1 ttl=64 time=0.125 ms
^C
[oracle@bys3 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
ADR_BASE_LISTENER = /u01
[oracle@bys3 admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 10:56:55
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/diag/tnslsnr/bys3/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                18-NOV-2013 10:56:57
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/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/diag/tnslsnr/bys3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@bys3 admin]$ lsnrctl status   --監聽已經正常執行,例項已經註冊進來了。--動態註冊
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 10:59:10
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                18-NOV-2013 10:56:57
Uptime                    0 days 0 hr. 2 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/diag/tnslsnr/bys3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "bys3" has 1 instance(s).
  Instance "bys3", status READY,
has 1 handler(s) for this service...
The command completed successfully
###############################################################################################################

實驗二:修改/etc/hosts中127.0.0.1條目,並分別修改listener.ora的三小步

將127.0.0.1      localhost.localdomain localhost條目改為127.0.0.1 bys3.bys.com bys3後,
再增加一條IP與域名對應即:192.168.1.211   bys3.bys.com
如下:
[root@bys3 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1      localhost.localdomain localhost
127.0.0.1      bys3.bys.com   bys3
::1             localhost6.localdomain6 localhost6
192.168.1.211   bys3.bys.com    bys3
[root@bys3 ~]# ping bys3
PING bys3.bys.com (127.0.0.1) 56(84) bytes of data.
64 bytes from bys3.bys.com (127.0.0.1): icmp_seq=1 ttl=64 time=0.122 ms
[root@bys3 ~]# ping bys3.bys.com
PING bys3.bys.com (127.0.0.1) 56(84) bytes of data.
64 bytes from bys3.bys.com (127.0.0.1): icmp_seq=1 ttl=64 time=0.118 ms
在修改了/etc/hosts中127.0.0.1條目後,分別實驗了以下三種情況(均為修改listener.ora檔案),
監聽日誌中的報錯資訊均為:WARNING: Subscription for node down event still pending

監聽配置一:使用NETCA建立監聽時的預設listener.ora檔案

此時重啟監聽,然後稍等(大約一分鐘後)檢查監聽狀態,監聽已經報錯,監聽日誌中報錯為WARNING: Subscription for node down event still pending
監聽配置檔案:
[oracle@bys3 admin]$ cat listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
ADR_BASE_LISTENER = /u01
啟動監聽並檢視狀態--檢視狀態要在監聽啟動後稍等一下檢視,會報錯。剛啟動完成時還是正常的。
[oracle@bys3 admin]$ lsnrctl start    ---啟動監聽
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 10:26:44
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/diag/tnslsnr/bys3/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                18-NOV-2013 10:26:45
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/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/diag/tnslsnr/bys3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@bys3 admin]$ lsnrctl status   ---監聽啟動後,稍等一下,檢視狀態,監聽程式已經掛了。
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 10:27:09
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
############################################################################################

監聽配置二:把預設監聽配置檔案中(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))這一行刪除

此時重啟監聽,然後稍等(大約一分鐘後)檢查監聽狀態,監聽已經報錯,監聽日誌中報錯為WARNING: Subscription for node down event still pending
監聽配置檔案:
[oracle@bys3 admin]$ cat listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = /u01
[oracle@bys3 admin]$ lsnrctl start      ---啟動監聽--輸出資訊和上一步監聽配置一中一樣,不太重要的資訊就不貼了。
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 10:37:24
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys3.bys.com)(PORT=1521)))
The listener supports no services
The command completed successfully

[oracle@bys3 admin]$ lsnrctl status         ---監聽啟動後,稍等一下,檢視狀態,監聽程式已經掛了。
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 10:39:12
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

############################################################################################

監聽配置三:把預設監聽配置檔案中(ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521))這一行的HOST中的域名改為IP

此時重啟監聽,然後稍等(大約一分鐘後)檢查監聽狀態,監聽已經報錯,監聽日誌中報錯為WARNING: Subscription for node down event still pending
監聽配置檔案:
[oracle@bys3 admin]$ cat listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = /u01
[oracle@bys3 admin]$ ping 192.168.1.211
PING 192.168.1.211 (192.168.1.211) 56(84) bytes of data.
64 bytes from 192.168.1.211: icmp_seq=1 ttl=64 time=1.04 ms
[oracle@bys3 admin]$ lsnrctl start               ---啟動監聽--輸出資訊和監聽配置一中一樣,不太重要的資訊就不貼了。
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.211)(PORT=1521)))
The listener supports no services
The command completed successfully

[oracle@bys3 admin]$ lsnrctl status             ---監聽啟動後,稍等一下,檢視狀態,監聽程式已經掛了。
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 10:42:27
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.211)(PORT=1521)))
TNS-12541: TNS:no listene
r
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
############################################################################################

實驗三:模擬出錯的場景為修改127.0.0.1 bys3.bys.com bys3,但是刪除192.168.1.211   bys3.bys.com    bys3條目。使用DBCA預設建立的listener.ora

此時重啟監聽,然後稍等(大約一分鐘後)檢查監聽狀態,監聽已經報錯,監聽日誌中報錯為WARNING: Subscription for node down event still pending
監聽配置檔案:
[root@bys3 ~]# cat /etc/hosts    
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1      localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
#192.168.1.211   bys3.bys.com   bys3
127.0.0.1      bys3.bys.com   bys3
[root@bys3 ~]# ping bys3.bys.com
PING bys3.bys.com (127.0.0.1) 56(84) bytes of data.
64 bytes from bys3.bys.com (127.0.0.1): icmp_seq=1 ttl=64 time=0.305 ms
^C
[root@bys3 ~]# ping bys3
PING bys3.bys.com (127.0.0.1) 56(84) bytes of data.
64 bytes from bys3.bys.com (127.0.0.1): icmp_seq=1 ttl=64 time=0.114 ms
^C
[oracle@bys3 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = bys3.bys.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
ADR_BASE_LISTENER = /u01

[oracle@bys3 admin]$ lsnrctl start      ---啟動監聽--輸出資訊和上一步監聽配置一中一樣,不太重要的資訊就不貼了。
The listener supports no services
The command completed successfully
[oracle@bys3 admin]$ lsnrctl status      --監聽啟動後,稍等一下,檢視狀態,監聽程式已經掛了。
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-NOV-2013 11:13:48
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys3.bys.com)(PORT=1521)))
TNS-12541: TNS:no listener

 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

相關文章