【LISTENER】修改 LISTENER的監聽埠為1526(動態註冊)

secooler發表於2010-02-22
曾經在下面文章中使用“靜態註冊”的方法完成監聽埠的修改,本文將使用修改資料庫修改初始化引數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 --

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-627534/,如需轉載,請註明出處,否則將追究法律責任。

相關文章