第五步,配置listener.ora和tnsnames.ora文件,内容如下:
#############################listener.ora##################################
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
LSNR2=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1526))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(SID_NAME=PROD))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(PROGRAM=extproc)))
############################################################################
###################################tnsnames.ora#############################
LSNR2=
(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1526))
PROD=
(description=
(address=(protocol=tcp)(host=secdb1)(port=1521))
(connect_data=
(service_name=PROD)
(server=dedicated)))
PROD_S=
(description=
(address=(protocol=tcp)(host=secdb1)(port=1526))
(connect_data=
(service_name=PROD)
(server=SHARED)))
PROD_1526=
(description=
(address=(protocol=tcp)(host=secdb1)(port=1526))
(connect_data=
(service_name=PROD)
(server=dedicated)))
第六步,修改local_listener参数
SYS@PROD>show parameter local
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
log_archive_local_first boolean TRUE
SYS@PROD>alter system set local_listener='LSNR2';
System altered.
SYS@PROD>show parameter local_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string LSNR2
第七步,先停掉刚才启动的监听
LSNRCTL> stop
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
第八步,先后启动两个监听listener 和 lsnr2
LSNRCTL> start listener
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/liste ner.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=secdb1.localdomain)(PORT =1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias listener
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 26-JUL-2012 21:40:56
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/list ener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
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
LSNRCTL> start lsnr2
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.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/lsnr2.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1526)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1526))
STATUS of the LISTENER
------------------------
Alias lsnr2
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 26-JUL-2012 21:42:20
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/lsnr2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1526)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
The listener supports no services
The command completed successfully
第九步,等待一会后(即,等待PMON把实例注册到监听上),查看两个监听的状态
LSNRCTL> status listener
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias listener
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 26-JUL-2012 22:27:21
Uptime 0 days 0 hr. 1 min. 47 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=secdb1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
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
LSNRCTL> status lsnr2
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1526))
STATUS of the LISTENER
------------------------
Alias lsnr2
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 26-JUL-2012 22:26:56
Uptime 0 days 0 hr. 2 min. 22 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/lsnr2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1526)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
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
结论:(3)oracle实例在启动过程中,或使用命令ALTER SYSTEM REGISTER,或每隔一分钟,PMON进程会向监听进行动态注册。如果是先启动的监听,后起的实例,那么实例会迅速动态注册到监听上;如果是先启动的实例,再启动的监听,那么要等待PMON进程的轮询时间到了之后才能注册到监听上~~~~~为了减少等待时间,就可以使用命令alter system register进行快速注册。
《官方文档》上的原话:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~“When alistener starts after the Oracle instance starts, and the listener is listed for service registration, registration does not occur until the next time the Oracle Database process monitor (PMON) discovery routine starts. By default, PMON discovery occurs every 60 seconds.
To override the 60-second delay, use the SQL ALTER SYSTEM REGISTER statement. This statement forces the PMON process to register the service immediately.
Oracle recommends that you create a script. to run this statement immediately after starting the listener. If you run this statement while the listener is up and the instance is already registered, or while the listener is down, then the statement has no effect.”~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~新手上路,多多指教~~
小妞elaine
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26863369/viewspace-737094/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26863369/viewspace-737094/
668

被折叠的 条评论
为什么被折叠?



