ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORACLE动态监听总结

ORACLE动态监听总结

原创 Linux操作系统 作者:wzq609 时间:2013-10-05 09:56:23 0 删除 编辑

1 动态监听
本文档介绍ORACLE动态监听服务的配置及原理;

1.1 监听文件
$ORACLE_HOME/network/admin/listener.ora

1.2 动态监听
ORACLE实例在启动时,或使用命令ALTER SYSTEM REGISTER ,或每隔一分钟,PMON进程会向监听进行动态注册1、监听在启动时,会从$ORACLE_HOME/network/admin/listener.ora读取监听配置,如果该文件不存在,则监听会在主机名对应的IP和1521端口上进行监听。可以看到监听刚刚启动的时候,并没有注册的服务
LSNRCTL> start
Starting tnslsnr: please wait...
TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Log messages written to f:\oracle\product\10.2.0\network\log\listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:29:40
Uptime 0 days 0 hr. 0 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File f:\oracle\product\10.2.0\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))
The listener supports no services
The command completed successfully
2、过了大概1分钟,PMON进程会将服务注册进来
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:29:40
Uptime 0 days 0 hr. 1 min. 57 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File f:\oracle\product\10.2.0\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))
Services Summary...
Service "test" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testXDB" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_XPT" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully
3、但是PMON进程只向默认的1521端口的监听注册,当监听不在1521端口时,需要使用下面的方法:
a、直接在参数local_listener中输入监听地址,PMON进程会根据此信息,并进行注册
sys@TEST>alter system set local_listener='(address=(protocol=tcp)(port=1527)(host= ekpdbtest))' scope=both;
System altered.
b、或者只在参数local_listener中输入监听的名称
sys@TEST>alter system set local_listener='test';
System altered.
在$ORACLE_HOME/network/admin/tnsnames.ora中包含监听地址,PMON进程会从此处得监听信息,并进行注册
TEST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1522))
4、但有3点需要注意的地方:
a、PMON进程1分钟运行一次,当监听刚刚启动的时候,可能服务还没有注册进去,这时候是不能使用此服务的
b、在修改local_listener参数时,PMON进程也会重新注册一次
c、如果数据库shutdown后,PMON进程也停止了,服务会从监听中删除,这时候只能使用OS认证的方式连入数据库
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linan)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:14:04
Uptime 0 days 0 hr. 10 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File f:\oracle\product\10.2.0\network\admin\listener.ora
Listener Log File f:\oracle\product\10.2.0\network\log\listener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1522)))
Services Summary...
Service "test" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
Service "testXDB" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
Service "test_XPT" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
sys@TEST>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=joeone-1)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:14:04
Uptime 0 days 0 hr. 10 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File f:\oracle\product\10.2.0\network\admin\listener.ora
Listener Log File f:\oracle\product\10.2.0\network\log\listener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1522)))
The listener supports no services
The command completed successfully

1.3 动态监听总结
监听服务是根据listener.ora设定的端口进行监听的,数据库启动的时候会默认根据1521的端口进行注册;
如果默认的端口不是1521的话,就需要修改参数文件的信息;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12679300/viewspace-773740/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-06-16

  • 博文量
    173
  • 访问量
    2908240