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=(SERVICE_NAME=PROD)(SERVER=dedicated)))lsnr2 =(DESCRIPTION=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = dbsv)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = dbsv)(PORT = 1526))))
寫法一:將資料庫動態註冊到單獨連接埠的監聽上
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:47Copyright (c) 1991, 2005, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 10.2.0.2.0 - ProductionStart Date 21-JUN-2014 10:42:29Uptime 0 days 1 hr. 27 min. 17 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/oracle/network/admin/listener.oraListener Log File /u01/oracle/network/log/listener.logListening 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 lsnr2LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 21-JUN-2014 12:09:59Copyright (c) 1991, 2005, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1526)))STATUS of the LISTENER------------------------Alias LSNR2Version TNSLSNR for Linux: Version 10.2.0.2.0 - ProductionStart Date 21-JUN-2014 10:40:53Uptime 0 days 1 hr. 29 min. 5 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/oracle/network/admin/listener.oraListener Log File /u01/oracle/network/log/lsnr2.logListening 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:26Copyright (c) 1991, 2005, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 10.2.0.2.0 - ProductionStart Date 21-JUN-2014 10:42:29Uptime 0 days 1 hr. 30 min. 56 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/oracle/network/admin/listener.oraListener Log File /u01/oracle/network/log/listener.logListening 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 lsnr2LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 21-JUN-2014 12:13:30Copyright (c) 1991, 2005, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbsv)(PORT=1526)))STATUS of the LISTENER------------------------Alias LSNR2Version TNSLSNR for Linux: Version 10.2.0.2.0 - ProductionStart Date 21-JUN-2014 10:40:53Uptime 0 days 1 hr. 32 min. 37 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/oracle/network/admin/listener.oraListener Log File /u01/oracle/network/log/lsnr2.logListening 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)了。