首页 > 代码库 > oracle动态注册参数local_listener
oracle动态注册参数local_listener
local_listener参数有两种书写格式,提供了不同的功能。
监听文件上,1521和1526端口上都有动态监听端口。
[oracle@dbsv admin]$ cat listener.ora LISTENER= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1521)) (ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=PROD) (ORACLE_HOME=/u01/oracle) (SID_NAME=PROD)) (SID_DESC= (GLOBAL_DBNAME=EMREP) (ORACLE_HOME=/u01/oracle) (SID_NAME=EMREP)) (SID_DESC= (SID_NAME=plsextproc) (ORACLE_HOME=/u01/oracle) (PROGRAM=extproc))) LSNR2= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1526)) (ADDRESS=(PROTOCOL=ipc)(KEY=extproc2))))
[oracle@dbsv admin]$ cat tnsnames.ora prod= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(port=1521))) (CONNECT_DATA=http://www.mamicode.com/(SERVICE_NAME=PROD)(SERVER=dedicated)))>
写法一:将数据库动态注册到单独端口的监听上alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=dbsv)(PORT=1526))';验证:[oracle@dbsv admin]$ lsnrctl stat LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 21-JUN-2014 12:09:47 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production Start Date 21-JUN-2014 10:42:29 Uptime 0 days 1 hr. 27 min. 17 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/network/admin/listener.ora Listener Log File /u01/oracle/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))) Services Summary... Service "EMREP" has 1 instance(s). Instance "EMREP", status UNKNOWN, has 1 handler(s) for this service... Service "PROD" has 1 instance(s). Instance "PROD", status UNKNOWN, has 1 handler(s) for this service... Service "plsextproc" has 1 instance(s). Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@dbsv admin]$ lsnrctl stat lsnr2 LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 21-JUN-2014 12:09:59 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1526))) STATUS of the LISTENER ------------------------ Alias LSNR2 Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production Start Date 21-JUN-2014 10:40:53 Uptime 0 days 1 hr. 29 min. 5 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/network/admin/listener.ora Listener Log File /u01/oracle/network/log/lsnr2.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1526))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc2))) Services Summary... Service "PROD" has 1 instance(s). Instance "PROD", status READY, has 1 handler(s) for this service... Service "PROD_XPT" has 1 instance(s). Instance "PROD", status READY, has 1 handler(s) for this service... The command completed successfully
1521上没有动态注册的监听库(READY),1526端口上有READY
方法二:将数据库动态注册到一个或多个开通动态注册服务的监听端口上
在tnsnames.ora文件中写出network_name描述的监听信息,如上面的lsnr2
alter system set local_listener=lsnr2;验证:[oracle@dbsv admin]$ lsnrctl stat LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 21-JUN-2014 12:13:26 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production Start Date 21-JUN-2014 10:42:29 Uptime 0 days 1 hr. 30 min. 56 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/network/admin/listener.ora Listener Log File /u01/oracle/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))) Services Summary... Service "EMREP" has 1 instance(s). Instance "EMREP", status UNKNOWN, has 1 handler(s) for this service... Service "PROD" has 2 instance(s). Instance "PROD", status UNKNOWN, has 1 handler(s) for this service... Instance "PROD", status READY, has 1 handler(s) for this service... Service "PROD_XPT" has 1 instance(s). Instance "PROD", status READY, has 1 handler(s) for this service... Service "plsextproc" has 1 instance(s). Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@dbsv admin]$ lsnrctl stat lsnr2 LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 21-JUN-2014 12:13:30 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1526))) STATUS of the LISTENER ------------------------ Alias LSNR2 Version TNSLSNR for Linux: Version 10.2.0.2.0 - Production Start Date 21-JUN-2014 10:40:53 Uptime 0 days 1 hr. 32 min. 37 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/network/admin/listener.ora Listener Log File /u01/oracle/network/log/lsnr2.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1526))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc2))) Services Summary... Service "PROD" has 1 instance(s). Instance "PROD", status READY, has 1 handler(s) for this service... Service "PROD_XPT" has 1 instance(s). Instance "PROD", status READY, has 1 handler(s) for this service... The command completed successfully两个端口上的监听,就都有数据库的动态注册(READY)了。
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。