???紵 发表于 2018-9-25 06:48:07

Oracle数据库修改LISTENER的监听端口

转自:http://www.cnblogs.com/chenleiustc/archive/2009/07/26/1531529.html  【强调一点】
  由于oracle实例的动态注册只能在默认端口1521上运行,端口修改后监听一定要记得修改为“静态注册”方式。
  否则您永远也等不到LISTENER动态监听到您的oracle实例!
  【修改步骤】
  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:>  Copyright (c) 1982, 2005, Oracle.All rights reserved.
  Connected to:

  Oracle Database 10g Enterprise Edition>  With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
  sec@ora10g>
  一切OK,修改成功!
  【买一赠一】修改监听端口号后企业管理器(Enterprise Manager)对应的调整
  1.修改emoms.properties属性文件中端口信息
  ora10g@testdb /home/oracle$ vi $ORACLE_HOME/${HOSTNAME}_${ORACLE_SID}/sysman/config/emoms.properties
  这个文件中有两行含有1521端口号的信息,将他们统统的修改为1526
  oracle.sysman.eml.mntr.emdRepPort=1521
  oracle.sysman.eml.mntr.emdRepConnectDescriptor=(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=testdb)(PORT\=1521)))(CONNECT_DATA\=(SERVICE_NAME\=ora10g)))
  这两个行修改后的内容如下
  oracle.sysman.eml.mntr.emdRepPort=1526
  oracle.sysman.eml.mntr.emdRepConnectDescriptor=(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=testdb)(PORT\=1526)))(CONNECT_DATA\=(SERVICE_NAME\=ora10g)))
  2.修改targets.xml配置文件中端口信息
  ora10g@testdb /home/oracle$ vi $ORACLE_HOME/${HOSTNAME}_${ORACLE_SID}/sysman/emd/targets.xml
  这个文件中的1521端口号的信息统统的修改为1526
  3.重启EM
  ora10g@testdb /home/oracle$ emctl stop dbconsole
  TZ set to PRC

  Oracle Enterprise Manager 10g Database Control>  Copyright (c) 1996, 2005 Oracle Corporation.All rights reserved.
  http://testdb:5500/em/console/aboutApplication
  Stopping Oracle Enterprise Manager 10g Database Control ...
  ...Stopped.
  ora10g@testdb /home/oracle$ emctl start dbconsole
  TZ set to PRC

  Oracle Enterprise Manager 10g Database Control>  Copyright (c) 1996, 2005 Oracle Corporation.All rights reserved.
  http://testdb:5500/em/console/aboutApplication
  Starting Oracle Enterprise Manager 10g Database Control ......................... started.
  ------------------------------------------------------------------
  Logs are generated in directory /oracle/app/oracle/product/10.2.0/db_1/testdb_ora10g/sysman/log
  4.验证EM登陆
  在本地浏览器中输入如下的URL
  http://144.194.192.183:5500/em/
  看到登陆界面了,OK,搞定ed。
  -- The End --

页: [1]
查看完整版本: Oracle数据库修改LISTENER的监听端口