動態和靜態監聽註冊-小魚的理解
關於網路上的動態和靜態監聽註冊,自己也是迷糊的,如果判斷動態和靜態相信大家都清楚,監聽程式自己也一直是停留在能用就行的地步,對於其中的原理也很難以理解透徹。
結合自己的測試談談自己的理解:
註冊:其實可以簡單的理解為把資料庫的服務註冊到監聽程式中,因為客戶端連線資料庫需要透過定位主機,然後檢視主機的監聽程式上的埠上面是否存在資料庫服務,然後核對使用者名稱和密碼,這個才是一次完整連線所要經歷的步奏。
那麼註冊正是把服務註冊到監聽程式中,讓其可以透過監聽程式去對客戶端和伺服器端做一個相對中介的事情,而如果不註冊監聽程式中沒有所謂的資料庫服務,客戶端也無法去定位連線。
靜態監聽:也就是例項啟動時透過listener.ora檔案把相應的資料庫例項和服務註冊到監聽程式中,監聽如果重啟也會去listen.ora檔案的資訊.
[oracle@localhost admin]$ less listener.ora
#listener.ora Network Configuration File:
/db/oracle10g/product/10.2.0/db/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME =
PLSExtProc)
(ORACLE_HOME =
/u01/app/oracle/10.2.0/db_1)
(PROGRAM =
extproc)
)
(SID_DESC =
(GLOBAL_DBNAME
= benguo)
(ORACLE_HOME = /u01/app/oracle/10.2.0/db_1)
(SID_NAME =
benguo)
)
)
# 下面的sid_desc這一段表示把靜態監聽程式已經把資料庫服務註冊到監聽程式中去了,而且是靜態註冊。
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS =
(PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)
上述是公司同事配置的listener.ora檔案
[oracle@localhost admin]$ lsnrctl status
……
Service "benguo" has 2 instance(s).
Instance
"benguo", status UNKNOWN, has 1 handler(s) for this service...
Instance
"benguo", status READY, has 1 handler(s) for this service...
…….
透過上述的Service "benguo" has 2 instance(s).其中的一個是unknown表示有個靜態監聽已經被註冊了,觀察上面listener.ora檔案,發現了正是手動新增listener.ora檔案中的最後的sid_destyi引起的靜態註冊,如果刪除最後的一段後如下形式:(靜態監聽的註冊已經消失,全部是read的動態監聽註冊)
listener.ora Network Configuration File:
/db/oracle10g/product/10.2.0/db/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME =
PLSExtProc)
(ORACLE_HOME =
/u01/app/oracle/10.2.0/db_1)
(PROGRAM =
extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS =
(PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)
————修改listener.ora檔案手動register讓pmon迅速動態註冊服務到監聽程式中,然後檢視status
[oracle@localhost admin]$ lsnrctl status
…
Service "benguo" has 1 instance(s).
Instance
"benguo", status READY, has 1 handler(s) for this service.
動態監聽:也就是例項啟動時pmon程式把資料庫服務資訊直接註冊到監聽程式中(pmon會讀取初始化引數檔案的services_name和instance_name註冊到監聽程式中),預設的不予以配置netca下就啟用了預設的監聽程式,當然netca配置也是可以完成動態監聽註冊的,而要分析是動態監聽下,如果監聽程式在例項啟動後再啟動,由於pmon的資訊的不是即時註冊的,或者說監聽在例項正常線上時重啟過,那麼監聽會丟失資料庫的服務資訊,可能就會出現下面的測試的例子:
[oracle@localhost admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on
18-JUL-2012 21:54:26
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias
LISTENER
Version TNSLSNR for Linux: Version
10.2.0.4.0 - Production
Start Date
18-JUL-2012 21:39:49
Uptime
0 days 0 hr. 14 min. 37 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP ON
Listener Parameter File
/usr/oracle/10.2/network/admin/listener.ora
Listener Log File
/usr/oracle/10.2/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "JHQL" has 1 instance(s).
Instance
"JHQL", status READY, has 1 handler(s) for this service...
Service "jhqlXDB" has 1 instance(s).
Instance
"JHQL", status READY, has 1 handler(s) for this service...
Service "jhql_XPT" has 1 instance(s).
Instance
"JHQL", status READY, has 1 handler(s) for this service...
The command completed successfully --可以看出都是動態註冊的
[oracle@localhost admin]$ lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on
18-JUL-2012 21:54:32
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle@localhost admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JUL-2012
21:54:40
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /usr/oracle/10.2/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.4.0 - Production
System parameter file is
/usr/oracle/10.2/network/admin/listener.ora
Log messages written to
/usr/oracle/10.2/network/log/listener.log
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias
LISTENER
Version
TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date
18-JUL-2012 21:54:40
Uptime
0 days 0 hr. 0 min. 0 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
ON
Listener Parameter File
/usr/oracle/10.2/network/admin/listener.ora
Listener Log File
/usr/oracle/10.2/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
--重啟監聽後並pmon並不會馬上去註冊服務到監聽程式中
不過這裡可以採取alter system
register手動註冊資訊到監聽程式中,而監聽程式馬上就能提供資料庫服務了
[oracle@localhost admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on
18-JUL-2012 21:54:45
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias
LISTENER
Version
TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date
18-JUL-2012 21:54:40
Uptime
0 days 0 hr. 0 min. 4 sec
Trace Level
off
Security ON: Local OS Authentication
SNMP
ON
Listener Parameter File
/usr/oracle/10.2/network/admin/listener.ora
Listener Log File
/usr/oracle/10.2/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
--過一段時間後服務已經被註冊到監聽程式中。
而如果此時監聽程式正常啟動,服務也被註冊到監聽程式中,如果關閉資料庫然後重啟,這個時候pmon程式在instance啟動後就會馬上把例項的服務註冊到監聽中,這個過程沒有延遲。這裡就不列出測試的例子了,大家可以自己檢視下!
靜態監聽表明監聽程式不知道例項的執行情況,只有客戶發出連線時才會去檢查例項是否還在執行,這個也跟靜態監聽程式unknown字面意思相符,而動態監聽不管何時關閉資料庫,都會在監聽中登出這個服務,而啟動時資料庫pmon也會馬上註冊服務到監聽中。Pmon還會定期的收集系統的負載到監聽中,最能體現的就是rac的負載均衡。
關於監聽自己也是反覆理解,反覆檢視資源結合自己實踐得出的,大家可以參考下,重要還是自己測試、理解!
[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25362835/viewspace-1058846/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【監聽】動態註冊和靜態註冊
- oracle監聽靜態註冊和動態註冊Oracle
- Oracle監聽的靜態註冊和動態註冊Oracle
- oracle監聽之動態和靜態註冊Oracle
- oracle監聽器的靜態和動態註冊Oracle
- Oracle監聽的動態註冊與靜態註冊Oracle
- oracle監聽動態註冊與靜態註冊Oracle
- oracle監聽動態註冊與靜態註冊[轉帖]Oracle
- 轉載:oracle監聽器的靜態和動態註冊Oracle
- oracle監聽器動態註冊於靜態註冊的區別Oracle
- 動態監聽和靜態監聽
- ORACLE 動態註冊,靜態註冊,多個監聽,一個監聽多個埠配置Oracle
- 監聽動態註冊
- 動態註冊監聽
- 動態監聽註冊
- 動態註冊和靜態註冊
- 靜態註冊和動態註冊
- oracle靜態監聽和動態監聽Oracle
- oracle的靜態註冊和動態註冊Oracle
- Oracle 靜態監聽註冊詳解Oracle
- oracle 監聽器動態與靜態註冊服務_listenerOracle
- rac監聽動態註冊
- 動態註冊監聽Listener
- Oracle 動態監聽註冊Oracle
- Oracle監聽器的靜態註冊與動態註冊,以及DB_DOMAIN問題OracleAI
- srvctl新增新的監聽和埠並靜態註冊
- Oracle listener靜態註冊和動態註冊Oracle
- 動態監聽與靜態監聽
- rac監聽不能動態註冊
- 理解Oracle9i中的監聽動態註冊Oracle
- 靜態註冊和動態註冊總結(zt)
- listener靜態註冊和動態註冊總結
- oracle動態和靜態監聽listenerOracle
- 【listener】oracle靜態監聽和動態監聽 【轉載】Oracle
- ORACLE動態監聽與靜態監聽Oracle
- 【oracle】動態監聽與靜態監聽Oracle
- oracle listener 靜態和動態註冊Oracle
- Oracle listener靜態註冊和動態註冊總結Oracle