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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 關於RAC的remote_listenerREM
- remote_listener引發的故障分析REM
- Linux scp命令詳述Linux
- 詳述netfilter 和 iptables!Filter
- Python作用域詳述Python
- DNS Bind日誌詳述DNS
- Android Handler 訊息機制詳述Android
- iOS Push詳述,瞭解一下?iOS
- RNN與LSTM網路簡述RNN
- 電商促銷後臺邏輯詳述
- 細述kubernetes HA安裝方式- sealos詳解
- 詳述盒子模型(包含padding、border、margin的詳細用法和描述)模型padding
- ORACLE之手動註冊監聽listener。alter system set local_listener="XXX"Oracle
- 詳述網路中ARP安全的綜合功能
- 簡述Linux 中程式與執行緒Linux執行緒
- 機器人路徑規劃 A*與D*機器人路徑規劃演算法詳述機器人演算法
- Spring Cloud :: Security :: OAuth2 – ⓪ OAuth2模型詳述SpringCloudOAuth模型
- [重慶思莊每日技術分享]-local_listener導致登入異常
- MySQL中介軟體之ProxySQL(7):詳述ProxySQL的路由規MySql路由
- Web 開發中 Blob 與 FileAPI 使用簡述WebAPI
- AntDB設計之CheckPoint——引言與功能簡述
- 簡述top命令與結束程式kill命令
- 簡述Spring容器與SpringMVC的容器的聯絡與區別SpringMVC
- 影片剪輯中生成花字特效的程式碼案例詳述特效
- CO-V價格控制的物料差異情況詳述。
- 阿里推薦與搜尋引擎-AI·OS綜述阿里AI
- CNN 模型壓縮與加速演算法綜述CNN模型演算法
- 圖神經網路綜述:模型與應用神經網路模型
- 排程器Quartz的簡述與使用總結quartz
- 如何使用商品詳情API介面獲取商品資料:一篇詳盡的論述API
- 詳述一條SQL引發的高CPU故障處理過程SQL
- 簡述元件化解決方案CTMediator與MGJRouter的主要思想元件化
- PHP名稱空間與自動載入簡述PHP
- RPA技術原理與RPA產品形態簡述
- sql server 索引闡述系列七 索引填充因子與碎片SQLServer索引
- 記述
- 深度學習行人重識別ReID最新綜述與展望深度學習
- 北大高歌教授綜述:生物資訊與大語言模型模型
- 聯邦GNN綜述與經典演算法介紹GNN演算法