Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2416379
  • 博文数量: 384
  • 博客积分: 10193
  • 博客等级: 上将
  • 技术积分: 3785
  • 用 户 组: 普通用户
  • 注册时间: 2005-06-09 18:02
文章分类

全部博文(384)

文章存档

2011年(10)

2010年(29)

2009年(39)

2008年(36)

2007年(43)

2006年(198)

2005年(29)

分类: Oracle

2006-08-30 18:39:03

oracle默认向监听本机1521端口的注册数据库实例, 但是某些情况下, 我们可能希望oracle注册数据库到别的监听非默认端口的监听器, 可以通过设置local_listener参数实现.

当前服务器启动了两个监听器, 分别监听1521和1531端口

oracle@blueice:~/product/9.2.0/network/admin$ lsnrctl stat

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 30-AUG-2006 23:16:34

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                30-AUG-2006 20:21:51
Uptime                    0 days 2 hr. 54 min. 43 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
oracle@blueice:~/product/9.2.0/network/admin$ lsnrctl stat LISTENERB

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 30-AUG-2006 23:16:41

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1531)))
STATUS of the LISTENER
------------------------
Alias                     LISTENERB
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                30-AUG-2006 23:14:14
Uptime                    0 days 0 hr. 2 min. 27 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listenerb.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1531)))
Services Summary...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

向tnsnames.ora中添加如下内容

LISTENERS_BLUEICE =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = BLUEICE)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = BLUEICE)(PORT = 1531))
  )

启动数据库实例, 修改初试化参数local_listener, 并验证设置结果

racle@blueice:~/product/9.2.0/network/admin$ sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on Wed Aug 30 23:18:02 2006

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> show parameter local

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string
SQL> alter system set local_listener="LISTENERS_BLUEICE";

System altered.

SQL> alter system register
  2  ;

System altered.

SQL> host lsnrctl stat

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 30-AUG-2006 23:18:41

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                30-AUG-2006 20:21:51
Uptime                    0 days 2 hr. 56 min. 50 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

SQL> host lsnrctl stat LISTENERB

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 30-AUG-2006 23:18:54

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=blueice.blueice.com)(PORT=1531)))
STATUS of the LISTENER
------------------------
Alias                     LISTENERB
Version                   TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                30-AUG-2006 23:14:14
Uptime                    0 days 0 hr. 4 min. 40 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /home/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /home/oracle/product/9.2.0/network/log/listenerb.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blueice.blueice.com)(PORT=1531)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl.blueice.com" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

在单机数据库中, 这种将监听器地址写在tnsnames.ora中的方式并不常见, 而rac数据库中则的remote_listener初试化参数则一般使用这种写法.

在具有多个ip地址的主机中, 即时指定listener监听某一个ip地址, listner也会监听所有ip地址.

blueice:~# netstat -lnp|grep \:15
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN     4716/tnslsnr
tcp        0      0 0.0.0.0:1531            0.0.0.0:*               LISTEN     10237/tnslsnr

所以, 如果在一台机器上建立多个监听器, 最好设置这些监听器监听多个不同的端口.
阅读(5367) | 评论(2) | 转发(0) |
0

上一篇:在线重定义表

下一篇:表在线重定义示例

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