【Oracle】修改oracle監聽埠

楊奇龍發表於2011-11-10
修改oracle 監聽埠號,過程相對比較簡單:
1 修改 listener.ora ,tnsnames.ora 檔案中的埠號
2 重啟監聽 lsnrctl stop ,lsnrctl start
上面的過程是對於 監聽名為預設的LISTENER 而言的,如果listener.oar檔案中的監聽名不是預設的,就重啟時必須指定監聽名。比如將埠號由1521改為1523
oracle@rac3:/opt/oracle/11.2.0/alifpre/network/admin>vi listener.ora 
# listener.ora Network Configuration File: /opt/oracle/11.2.0/alifpre/network/admin/listener.ora
# Generated by Oracle configuration tools.
yangdb =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac3)(PORT = 1523))
    )
  )
ADR_BASE_LISTENER = /opt/oracle
oracle@rac3:/opt/oracle/11.2.0/alifpre/network/admin>vi tnsnames.ora 
# tnsnames.ora Network Configuration File: /opt/oracle/11.2.0/alifpre/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
yangdb =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.250.7.241 )(PORT = 1523))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = yangdb)
    )
  )
"tnsnames.ora" 77L, 1572C 已寫入  
重啟監聽:
oracle@rac3:/opt/oracle/11.2.0/alifpre/network/admin>lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-NOV-2011 01:09:20
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
如啟動的時候 不指定監聽名稱,預設為LISTENER 且埠也是預設的 1521
oracle@rac3:/opt/oracle/11.2.0/alifpre/network/admin>lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-NOV-2011 01:09:33
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Starting /opt/oracle/11.2.0/alifpre/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/11.2.0/alifpre/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/rac3/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3)(PORT=1521)))
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                11-NOV-2011 01:09:33
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/11.2.0/alifpre/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/rac3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "yangdb" has 1 instance(s).
  Instance "yangdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
指定監聽名稱,啟動監聽yangdb,注意 Alias 的名稱 yangdb,這次埠號為1523
oracle@rac3:/opt/oracle/11.2.0/alifpre/network/admin>lsnrctl start yangdb
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-NOV-2011 01:10:04
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3)(PORT=1523)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac3)(PORT=1523)))
STATUS of the LISTENER
------------------------
Alias                     yangdb
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                11-NOV-2011 01:10:04
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/11.2.0/alifpre/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/rac3/yangdb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3)(PORT=1523)))
The listener supports no services
The command completed successfully

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

相關文章