local_listener與remote_listener詳述
簡述一下local_listener與remote_listener這兩個引數的含義(針對rac環境)
在安裝完RAC以後,oracle會自動修改local_listener和remote_listener這兩個引數,同時把兩個節點的3要素新增到$ORACLE_HOME/network/admin下的tnsnames.ora檔案中:
1.檢視listeners_devdb服務名配置
[oracle@rac21admin]$ more tnsnames.ora
LISTENERS_DEVDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
)
2.show parameter local_listener and remote_listener
[oracle@rac1 admin]$ sqlplus /nolog
SQL> conn sys/oracle@devdb1 as sysdba
Connected.
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.230.68)(PORT = 1521))
remote_listener string LISTENERS_DEVDB
SQL> conn sys/oracle@devdb2 as sysdba
Connected.
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.230.69)(PORT = 1521))
remote_listener string LISTENERS_DEVDB
3.檢視listener狀態
節點1
[oracle@rac1 admin]$ lsnrctl status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER_RAC1
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 28-APR-2009 10:36:56
Uptime 0 days 8 hr. 1 min. 20 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_rac1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.230.68)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "devdb" has 2 instance(s).
Instance "devdb1", status READY, has 2 handler(s) for this service...
Instance "devdb2", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac1 admin]$ lsnrctl service
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "devdb" has 2 instance(s).
Instance "devdb1", status READY, has 2 handler(s) for this service...
Handler(s):
"DEDICATED" established:1 refused:0 state:ready
LOCAL SERVER --local_listener引數
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER --remote_listener引數
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.68)(PORT=1521))
Instance "devdb2", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER --remote_listener引數
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.69)(PORT=1521))
The command completed successfully
節點2
[oracle@rac2 admin]$ lsnrctl status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER_RAC2
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 28-APR-2009 15:25:45
Uptime 0 days 3 hr. 18 min. 21 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_rac2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.230.69)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.230.67)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "devdb" has 2 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
Instance "devdb2", status READY, has 2 handler(s) for this service...
The command completed successfully
[oracle@rac2 admin]$ lsnrctl service
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "devdb" has 2 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER --remote_listener引數
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.68)(PORT=1521))
Instance "devdb2", status READY, has 2 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER --remote_listener引數
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.69)(PORT=1521))
"DEDICATED" established:1 refused:0 state:ready
LOCAL SERVER --local_listener引數
The command completed successfully
過程描述:
當客戶端發出連線請求給server端listener的時候,透過local_listener註冊的服務接收這個連線請求,然後由master instance來決定這個連線請求應該由哪個目標instance發出server process響應這個連線請求。如果啟用負載均衡,那麼主節點會選擇cpu負載最小的那個instance,此時
如果master分配的目標instance是local listener machine,那麼直接透過local server listener,開啟後臺的server process,處理發出conn的客戶端,建立連線,處理會話;
如果master分配的目標instance不是local listener machine,那麼會透過remote_listener這個引數,把連線請求轉移到remote machine上的listener, 然後由remote service listener發出一個server process返回客戶端,建立連線,處理會話.
當conn建立連線以後,listener就沒有用了,不會再用到了,如果這個時候,已經連線的那個instance down了,會重新由新分配的master instance透過remote_listener切換到可用instance,此時客戶不會發現連線中斷。conn 和 select操作是不會中斷的。
備註:shut down instance2,重啟listener,測試監聽服務狀態
[oracle@rac2 admin]$ sqlplus /nolog
SQL> conn sys/oracle@devdb2 as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
[oracle@rac2 admin]$ lsnrctl status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER_RAC2
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 28-APR-2009 15:25:45
Uptime 0 days 3 hr. 43 min. 44 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_rac2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.230.69)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.230.67)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "devdb" has 1 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac2 admin]$ lsnrctl service
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "devdb" has 1 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.68)(PORT=1521))
The command completed successfully
[oracle@rac2 admin]$ lsnrctl stop
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle@rac2 admin]$ lsnrctl start
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.4.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=rac2.domain.com)(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 28-APR-2009 19:11:08
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=rac2.domain.com)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@rac2 admin]$ lsnrctl status
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 28-APR-2009 19:11:08
Uptime 0 days 0 hr. 3 min. 28 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=rac2.domain.com)(PORT=1521)))
Services Summary...
Service "devdb" has 1 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac2 admin]$ lsnrctl service
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "devdb" has 1 instance(s).
Instance "devdb1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.68)(PORT=1521))
The command completed successfully
此時可以看出,即使關閉例項2了,重啟listener,但是例項2的service devdb 仍然可用,所以由此可以看出:
當例項1註冊監聽的時候,即使節點2的instance沒有啟動,也會透過remote_listener在節點2server上註冊相應的listener1.它是在資料庫啟動的時候,新增到相應的listener service裡的。
參考文獻:原創
listener的靜態註冊與動態註冊詳述 http://space.itpub.net/9252210/viewspace-580699
itpub oracle 10g dba培訓課程筆記(三) http://space.itpub.net/9252210/viewspace-578120
安裝完RAC以後dba需要2點手工操作 http://space.itpub.net/9252210/viewspace-573149
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9252210/viewspace-592111/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- remote_listener和local_listenerREM
- local_listener 與 remote_listener 引數說明REM
- local_listener ,remote_listener 的配置REM
- 關於local_listener、remote_listener、current_listenerREM
- LOCAL_LISTENER 和 REMOTE_LISTENER說明 ——轉自chinaunixREM
- HTML介紹詳述HTML
- listener的靜態註冊與動態註冊詳述
- remote_listener和listener passwordREM
- Python作用域詳述Python
- DNS Bind日誌詳述DNS
- Linux scp命令詳述Linux
- Oracle後臺程式詳述Oracle
- 關於RAC的remote_listenerREM
- 詳述netfilter 和 iptables!Filter
- Android 開發者選項詳述Android
- [Oracle] Oracle RAC中local_listener指定Oracle
- remote_listener引發的故障分析REM
- SQL Server 索引結構詳述(1)SQLServer索引
- 正規表示式regular expression詳述Express
- 詳述C++語言的VxD與外界通訊的所有介面 (轉)C++
- TNSNAMES TAF TEMPLATE , LOCAL_LISTENER RAC FAILOVERAI
- 美國白宮85頁報告詳述大資料的機遇與挑戰大資料
- Android Handler 訊息機制詳述Android
- iOS Push詳述,瞭解一下?iOS
- 【SAP業務模式】之ICS(一):業務詳述模式
- RNN與LSTM網路簡述RNN
- LLVM思想與功能綜述LVM
- 詳述Linux ftp命令的使用方法LinuxFTP
- 詳述top命令監視程式的內容
- 詳細講述Oracle RAC入門和提高Oracle
- 簡述MFC程式生與死 (轉)C程式
- REMOTE_LISTENER對靜態FAILOVER的影響REMAI
- 詳述網路中ARP安全的綜合功能
- Linux檔案查詢命令find,xargs詳述Linux
- 詳細闡述遊戲方法多種基本理念(轉)遊戲
- REMOTE_LISTENER對LOAD_BALANCE的影響(二)REM
- REMOTE_LISTENER對LOAD_BALANCE的影響(一)REM
- 機器人路徑規劃 A*與D*機器人路徑規劃演算法詳述機器人演算法