【LISTENER】謹防相同的 IPC key導致多監聽無法啟動--TNS-1106故障處理

secooler發表於2010-08-08
若想順利實現在資料庫伺服器上啟動多個監聽,需要保證兩個前提條件:1.埠號要不同;2.IPC key值要不同。
第一前提依照常識很容易理解,因為我們很多時候啟動多個監聽的目的就是為了在不同的埠上對外提供服務。
第二前提有時很容易忽視,例如簡簡單單的將預設的listener配置資訊複製後僅修改了埠號,此時就導致新配置的監聽無法啟動的問題。

簡單展示一下由於IPC key相同但埠號不同導致非預設監聽無法啟動的過程。

1.錯誤的監聽配置檔案內容
$ vi $ORACLE_HOME/network/admin/listener.ora
listener=
  (description=
    (address=(protocol=tcp)(host=secdb1)(port=1521))
    (address=(protocol=ipc)(key=extproc)))

listener_1526=
  (description=
    (address=(protocol=tcp)(host=secdb1)(port=1526))
    (address=(protocol=ipc)(key=extproc)))

sid_list_listener=
  (sid_list=
    (sid_desc=
      (sid_name=plsextproc)
      (oracle_home=/u01/app/oracle/product/10.2.0/db_1)
      (program=extproc)))

2.此時啟動預設監聽可以成功
[oracle@secdb1 admin]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 8-AUG-2010 14:39:54

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

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))

Connecting to (DESCRIPTION=(address=(protocol=tcp)(host=secdb1)(port=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                8-AUG-2010 14:39:54
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/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "plsextproc" has 1 instance(s).
  Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


3.但在啟動listener_1526監聽的時候遇到了TNS-01106問題
[oracle@secdb1 admin]$ lsnrctl start listener_1526

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 8-AUG-2010 14:40:16

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

TNS-01106: Listener using listener name LISTENER has already been started


4.問題原因
問題是由listener_1526中指定的“(address=(protocol=ipc)(key=extproc))”與listener中的“(address=(protocol=ipc)(key=extproc))”相同導致的。
在這種IPC key相同的情況下,listener_1526監聽是無法正常啟動的。

5.問題處理
我們可以透過取消listener_1526監聽配置中的“(address=(protocol=ipc)(key=extproc))”,或者透過修改key值的方法來解決該問題。
1)透過修改IPC key值的方法來處理
(1)修改後的listener.ora檔案內容如下
listener=
  (description=
    (address=(protocol=tcp)(host=secdb1)(port=1521))
    (address=(protocol=ipc)(key=extproc)))

listener_1526=
  (description=
    (address=(protocol=tcp)(host=secdb1)(port=1526))
    (address=(protocol=ipc)(key=extproc_1526)))

sid_list_listener=
  (sid_list=
    (sid_desc=
      (sid_name=plsextproc)
      (oracle_home=/u01/app/oracle/product/10.2.0/db_1)
      (program=extproc)))

(2)此時啟動listener_1526監聽成功
[oracle@secdb1 admin]$ lsnrctl start listener_1526

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 8-AUG-2010 14:46:58

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

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener_1526.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1526)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc_1526)))

Connecting to (DESCRIPTION=(address=(protocol=tcp)(host=secdb1)(port=1526)))
STATUS of the LISTENER
------------------------
Alias                     listener_1526
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                8-AUG-2010 14:46:58
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/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener_1526.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1526)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc_1526)))
The listener supports no services
The command completed successfully


2)透過取消IPC key值的方法來處理
(1)修改後的listener.ora檔案內容如下
listener=
  (description=
    (address=(protocol=tcp)(host=secdb1)(port=1521))
    (address=(protocol=ipc)(key=extproc)))

listener_1526=
  (description=
    (address=(protocol=tcp)(host=secdb1)(port=1526)))

sid_list_listener=
  (sid_list=
    (sid_desc=
      (sid_name=plsextproc)
      (oracle_home=/u01/app/oracle/product/10.2.0/db_1)
      (program=extproc)))


(2)此時啟動listener_1526監聽亦可成功
[oracle@secdb1 admin]$ lsnrctl start listener_1526

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 8-AUG-2010 14:50:30

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

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener_1526.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1526)))

Connecting to (DESCRIPTION=(address=(protocol=tcp)(host=secdb1)(port=1526)))
STATUS of the LISTENER
------------------------
Alias                     listener_1526
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                8-AUG-2010 14:50:30
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/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener_1526.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1526)))
The listener supports no services
The command completed successfully

BTW:如果使用的是netca工具建立的兩個監聽,監聽配置檔案listener.ora內容屬於上述的第二中場景:取消IPC key值的方法。
下面是透過netca工具建立的listener.ora檔案內容,複製在此,供參考。
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = secdb1.localdomain)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

LISTENER_1526 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = secdb1.localdomain)(PORT = 1526))
    )
  )

6.小結
再次強調一下,如果想在資料庫伺服器上啟動多個監聽,需要保證兩個前提條件:1.埠號要不同;2.IPC key值要不同。
越是在緊要關頭,我們越需要的是冷靜。

Good luck.

secooler
10.08.08

-- The End --

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-670863/,如需轉載,請註明出處,否則將追究法律責任。

相關文章