修改oracle动态监听端口

想要修改oracle动态监听的端口号必须同时修改listener.ora文件和动态参数local_listener才能成功在修改后的端口监听到数据库。

1、数据库默认动态监听
oracle数据库在没有listener.ora文件,没有设置local_listener参数时,默认监听的是1521端口。

默认 local_listener为空
SQL> show parameter local_listener;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string


数据库成功监听在1521端口
-------------------------------------------------------------------------------------------------------------------------
[oracle@rac1 admin]$ lsnrctl status         


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-JUL-2014 14:57:29


Copyright (c) 1991, 2009, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                02-JUL-2014 14:57:07
Uptime                    0 days 0 hr. 0 min. 22 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1521)))
Services Summary...
Service "center" has 1 instance(s).
  Instance "center", status READY, has 1 handler(s) for this service...
The command completed successfully
------------------------------------------------------------------------------------------------------------------------------



2、只修改local_listener参数
现把local_listener的监听端口改成1251,不创建监听文件

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.16.228)(PORT=1251))))' scope=both;     
System altered.

重启监听,用alter system register;手动注册动态监听,查看监听状态。

[oracle@rac1 admin]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-JUL-2014 15:14:13


Copyright (c) 1991, 2009, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                02-JUL-2014 15:13:48
Uptime                    0 days 0 hr. 0 min. 24 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1521)))
The listener supports no services
The command completed successfully

可以看出数据库监听还是启动在1521端口下,但监听不到数据库


3、创建listener.ora,监听端口为1251

[oracle@rac1 admin]$ more listener.ora 
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1251))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

重启监听,用alter system register;手动注册动态监听,查看监听状态。

[oracle@rac1 admin]$ lsnrctl status         


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-JUL-2014 15:20:20


Copyright (c) 1991, 2009, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1)(PORT=1251)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                02-JUL-2014 15:20:01
Uptime                    0 days 0 hr. 0 min. 19 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1251)))
Services Summary...
Service "center" has 1 instance(s).
  Instance "center", status READY, has 1 handler(s) for this service...
The command completed successfully

数据库监听成功在1251下监听到数据库


4、创建listener.ora,监听端口为1251


SQL> alter system set local_listener='' scope=both;

System altered.

重启监听,用alter system register;手动注册动态监听,查看监听状态。

[oracle@rac1 admin]$ lsnrctl status     


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-JUL-2014 15:35:36


Copyright (c) 1991, 2009, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1)(PORT=1251)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                02-JUL-2014 15:32:29
Uptime                    0 days 0 hr. 3 min. 7 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1251)))
The listener supports no services
The command completed successfully

可以看出数据库监听还是启动在1251端口下,但监听不到数据库


总计:要修改动态监听的端口号必须同时修改liserner.ora和动态参数local_listener中的端口号才行。

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

转载于:http://blog.itpub.net/26794255/viewspace-1207193/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值