服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|数据库技术|

服务器之家 - 数据库 - Oracle - Oracle 11g2的监听器配置教程

Oracle 11g2的监听器配置教程

2019-11-16 16:53Oracle教程网 Oracle

Oracle的监听器服务注册方式有两种,分别为动态和静态,本文将详细介绍这两种,需要的朋友可以参考下

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的文件链接。

延伸 · 阅读

精彩推荐