oracle动态注冊參数local_listener
local_listener參数有两种书写格式,提供了不同的功能。
监听文件上,1521和1526port上都有动态监听port。
[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=(SERVICE_NAME=PROD)(SERVER=dedicated))) lsnr2 = (DESCRIPTION= (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = dbsv)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dbsv)(PORT = 1526)) ) )
写法一:将数据库动态注冊到单独port的监听上
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)。1526port上有READY
方法二:将数据库动态注冊到一个或多个开通动态注冊服务的监听port上
在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两个port上的监听。就都有数据库的动态注冊(READY)了。