【LISTENER】修改 LISTENER的监听端口为1526(动态注册)

曾经在下面文章中使用“静态注册”的方法完成监听端口的修改,本文将使用修改数据库修改初始化参数local_listener的方法来完成监听端口的调整。
《【LISTENER】修改 LISTENER的监听端口为1526(静态注册)》
http://space.itpub.net/519536/viewspace-609822

1.查看监听状态
secooler@secDB /home/oracle$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-FEB-2010 20:53:34

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                22-FEB-2010 18:07:25
Uptime                    0 days 2 hr. 46 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /oracle/ora11gR2/diag/tnslsnr/secDB/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secDB)(PORT=1521)))
Services Summary...
Service "secooler" has 1 instance(s).
  Instance "secooler", status READY, has 2 handler(s) for this service...
The command completed successfully

2.停止监听
secooler@secDB /home/oracle$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-FEB-2010 20:54:03

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully


3.修改tnsnames.ora和listener.ora文件中的端口号
1)修改listener.ora文件中的端口号为“1526”
secooler@secDB /home/oracle$ vi $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = secDB)(PORT = 1526))
    )
  )

ADR_BASE_LISTENER = /oracle/ora11gR2

~
~

2)修改tnsnames.ora文件中的端口号为“1526”
secooler@secDB /home/oracle$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

SECOOLER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = secDB)(PORT = 1526))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = secooler)
    )
  )

~
~

4.在数据库中修改初始化参数local_listener
secooler@secDB /home/oracle$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 22 21:02:24 2010

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

sys@secooler> show parameter local_listener

NAME           TYPE    VALUE
-------------- ------- ------------------------------------------------------
local_listener string
sys@secooler> alter system set local_listener="(ADDRESS = (PROTOCOL = TCP)(HOST = secDB)(PORT = 1526))";

System altered.

sys@secooler> show parameter local_listener

NAME           TYPE    VALUE
-------------- ------- -------------------------------------------------------
local_listener string  (ADDRESS = (PROTOCOL = TCP)(HOST = secDB)(PORT = 1526))


5.启动监听
secooler@secDB /home/oracle$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-FEB-2010 21:04:03

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

Starting /oracle/ora11gR2/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/ora11gR2/diag/tnslsnr/secDB/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secDB)(PORT=1526)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                22-FEB-2010 21:04:03
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /oracle/ora11gR2/diag/tnslsnr/secDB/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secDB)(PORT=1526)))
The listener supports no services
The command completed successfully

secooler@secDB /home/oracle$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-FEB-2010 21:04:14

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                22-FEB-2010 21:04:03
Uptime                    0 days 0 hr. 0 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /oracle/ora11gR2/diag/tnslsnr/secDB/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secDB)(PORT=1526)))
Services Summary...
Service "secooler" has 1 instance(s).
  Instance "secooler", status READY, has 2 handler(s) for this service...
The command completed successfully


6.修改完毕,测试新端口1526
secooler@secDB /home/oracle$ sqlplus sec/sec@secooler

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 22 21:07:43 2010

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

sec@secooler>

7.小结
使用“动态注册”方法修改监听端口的步骤如下:
1)查看监听状态
2)停止监听
3)修改tnsnames.ora和listener.ora文件中的端口号
4)在数据库中修改初始化参数local_listener
5)启动监听
6)修改完毕,测试新端口1526

Good luck.

secooler
10.02.22

-- The End --

请使用浏览器的分享功能分享到微信等