ITPub博客

首页 > 数据库 > Oracle > 【LISTENER】修改 LISTENER的监听端口为1526(静态注册)

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

原创 Oracle 作者:OCMU联盟 时间:2009-07-21 22:41:51 0 删除 编辑
【强调一点】
动态注册默认只注册到默认的监听器上(名称是LISTENER、端口是1521、协议是TCP),如果需要向非默认监听注册,则需要配置local_listener参数。
此文不讨论通过设置local_listener参数完成监听的的动态注册。我们将采用“静态注册”的方法来完成监听端口的调整。

【修改步骤】
1.修改listener.ora文件,端口从1521修改成1526;同时将监听改为“静态注册”
listener.ora文件修改前:
ora10g@testdb /home/oracle$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 144.194.192.183)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

listener.ora文件修改后:
ora10g@testdb /home/oracle$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =   ## 静态注册在这里体现
      (GLOBAL_DBNAME = ora10g)
      (ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
      (SID_NAME = ora10g)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 144.194.192.183)(PORT = 1526)(IP = FIRST)) ## 端口修改在这里体现
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

2.修改tnsnames.ora文件,将其中出现的1521端口号修改为1526
ora10g@testdb /home/oracle$ cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORA10G =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 144.194.192.183)(PORT = 1526))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ora10g)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

3.重新启动LISTENER
LSNRCTL> stop
LSNRCTL> start
Starting /oracle/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=144.194.192.183)(PORT=1526)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=144.194.192.183)(PORT=1526)(IP=FIRST)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                21-JUL-2009 16:21:21
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /oracle/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=144.194.192.183)(PORT=1526)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "ora10g" has 1 instance(s).
  Instance "ora10g", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>

4.使用“ora10g”进行测试
ora10g@testdb /home/oracle$ sqlplus sec/sec@ora10g

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 21 16:21:32 2009

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

sec@ora10g>

一切OK,修改成功!

5.小结
使用“静态注册”方法修改监听端口的步骤如下:
1)修改listener.ora文件,端口从1521修改成1526;同时将监听改为“静态注册”;
2)修改tnsnames.ora文件,将其中出现的1521端口号修改为1526;
3)重新启动LISTENER;
4)测试。

Good luck.

secooler
09.07.21

-- The End --

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

请登录后发表评论 登录
全部评论
OCM联盟( Oracle Certified Master Union)是由侯圣文(ACE总监)发起的一个公益组织,旨在为每一个OCM大师提供一个可以继续展示自己才华,技术和实力的平台。

注册时间:2007-05-27

  • 博文量
    799
  • 访问量
    8406979