Chinaunix首页 | 论坛 | 博客
  • 博客访问: 35618
  • 博文数量: 16
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 5
  • 用 户 组: 普通用户
  • 注册时间: 2017-09-11 08:57
文章分类
文章存档

2013年(16)

分类: Oracle

2013-04-19 15:25:31

oracle监听注册

http://www.cnblogs.com/rootq/articles/1167777.html

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=1522)(host=linan))';

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>shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

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. 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


阅读(1344) | 评论(0) | 转发(0) |
0

上一篇: 为什么发不了

下一篇:AIX 用户和组管理

给主人留下些什么吧!~~