Oracle的監聽器服務註冊方式有兩種,分別為動態和靜態。通過動態註冊的服務在lsnrctl status時顯示的狀態為ready,靜態服務為unknown。
11g2以前的版本,監聽器通過listener.ora檔案進行配置。在11g2版本中,監聽器的配置方式發生了變化,增加了一個新的設定檔endpoints_listener.ora,並且此檔案和原來的listener.ora檔案都轉移到$GRID_HOME/network/admin目錄下了。
11g2的監聽器的配置資訊儲存在$GRID_HOME/network/admin/listener.ora和endpoints_listener.ora兩個檔案中。
檔案endpoints_listener.ora的內容如下:
.ora代碼 複製代碼 代碼如下:LISTENER_SERV2=
(DESCRIPTION=
(
ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=xxdb2-vip)(PORT=1551))
(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.100)(PORT=1551)(IP=FIRST))
)
)
檔案listener.ora的內容如下:
.ora代碼 複製代碼 代碼如下:LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_WFG=ON # line added by Agent
.ora代碼
##靜態服務註冊添加條目 複製代碼 代碼如下:SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = servdb)
(ORACLE_HOME = /u01/oracle/app/oracle/product/10.2.0/db)
(SID_NAME = servdb1)
)
)
如果需要添加靜態註冊的服務,和以前版本一樣是在listener.ora檔案中添加相應的條目。
使用lsnrctl status listener檢查監聽器狀態,如下:
Log代碼 複製代碼 代碼如下:LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 29-NOV-2012 14:18:34
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias listener
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 29-NOV-2012 14:11:17
Uptime 0 days 0 hr. 7 min. 17 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0.3/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/serv2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.100)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.101)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "SERVDG2" has 1 instance(s).
Instance "servdb1", status READY, has 1 handler(s) for this service...
Service "SERVDG2_XPT" has 1 instance(s).
Instance "servdb1", status READY, has 1 handler(s) for this service...
Service "elvdb" has 2 instance(s).
Instance "elvdb1", status UNKNOWN, has 1 handler(s) for this service...
Instance "elvdb2", status READY, has 1 handler(s) for this service...
Service "elvdbXDB" has 1 instance(s).
Instance "elvdb2", status READY, has 1 handler(s) for this service...
The command completed successfully
在11g2的grid infrastructure上安裝oracle 10g,10g的監聽器設定檔也要採用$GRID_HOME/network/admin下的檔案。
但需要做一個折中操作,將10g的$ORACLE_HOME/network/admin下listener.ora檔案設定為$GRID_HOME/network/admin下endpoints_listener.ora的檔案連結。