oracle动态监听如何配置,ORACLE动态监听总结

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

$ORACLE_HOME/network/admin/listener.ora

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=1521)(host= 192.168.19.128))' 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

监听服务是根据listener.ora设定的端口进行监听的,数据库启动的时候会默认根据1521的端口进行注册;

如果默认的端口不是1521的话,就需要修改参数文件的信息;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值