主要是修改两个文件和修改 oracle 参数 local_listener
1 查看当前监听状态
- [oracle@test ~]$ lsnrctl status
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-JUL-2018 14:26:26
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.162.4.68)(PORT=1521)))
- STATUS of the LISTENER
- ------------------------
- Alias LISTENER
- Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
- Start Date 11-JUN-2018 17:39:44
- Uptime 23 days 20 hr. 46 min. 42 sec
- Trace Level off
- Security ON: Password or Local OS Authentication
- SNMP OFF
- Listener Parameter File /data/App/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
- Listener Log File /data/App/oracle/diag/tnslsnr/DSJ-RTB-4T-349/listener/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.162.4.68)(PORT=1521)))
- (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 "dwca" has 1 instance(s).
- Instance "dwca", status READY, has 1 handler(s) for this service...
- Service "dwcaXDB" has 1 instance(s).
- Instance "dwca", status READY, has 1 handler(s) for this service...
- The command completed successfully
2 关闭监听
- [oracle@test ~]$ lsnrctl stop
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-JUL-2018 14:29:30
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.162.4.68)(PORT=1521)))
- The command completed successfully
3 修改监听端口号
端口修改为 2345, 主要修改 $ORACLE_HOME/network/admin / 目录下的两个文件, listener.ora 和 tnsnames.ora
修改 PORT
- (ADDRESS = (PROTOCOL = TCP)(HOST = 10.162.4.68)(PORT = 2345))
- [oracle@test admin]$ cd $ORACLE_HOME/network/admin/
- [oracle@test admin]$ VIM listener.ora
- [oracle@test admin]$ cat listener.ora
- # listener.ora Network Configuration File: /data/App/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
- # Generated by Oracle configuration tools.
- SID_LIST_LISTENER =
- (SID_LIST =
- (SID_DESC =
- (SID_NAME = PLSExtProc)
- (ORACLE_HOME = /data/App/oracle/product/11.2.0/dbhome_1)
- (PROGRAM = extproc)
- )
- )
- LISTENER =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 10.162.4.68)(PORT = 2345))
- (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
- )
- )
- #----ADDED BY TNSLSNR 11-APR-2018 16:08:51---
- PASSWORDS_LISTENER = 313DBE5E70EB94B5
- #--------------------------------------------
- [oracle@test admin]$ vi tnsnames.ora
- [oracle@test admin]$ cat tnsnames.ora
- DWCA =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 10.162.4.68)(PORT = 2345))
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = dwca)
- )
- )
- EXTPROC_CONNECTION_DATA =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
- )
- (CONNECT_DATA =
- (SID = PLSExtProc)
- (PRESENTATION = RO)
- )
- )
- LISTENER_DWCA =
- (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
4 修改初始化参数 local_listener
- [oracle@test admin]$ sqlplus / as sysdba;
- SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 5 14:38:41 2018
- 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, OLAP, Data Mining and Real Application Testing options
- SQL> show parameter local_listener;
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- local_listener string LISTENER_DWCA
- SQL> alter system set local_listener="(address=(protocol=tcp)(host=10.162.4.68)(port=2345))";
- System altered.
5 重新开启监听
- [oracle@test admin]$ lsnrctl start
- LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-JUL-2018 14:41:06
- Copyright (c) 1991, 2009, Oracle. All rights reserved.
- Starting /data/App/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
- TNSLSNR for Linux: Version 11.2.0.1.0 - Production
- System parameter file is /data/App/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
- Log messages written to /data/App/oracle/diag/tnslsnr/DSJ-RTB-4T-349/listener/alert/log.xml
- Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.162.4.68)(PORT=2345)))
- Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
- Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.162.4.68)(PORT=2345)))
- STATUS of the LISTENER
- ------------------------
- Alias LISTENER
- Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
- Start Date 05-JUL-2018 14:41:06
- Uptime 0 days 0 hr. 0 min. 0 sec
- Trace Level off
- Security ON: Password or Local OS Authentication
- SNMP OFF
- Listener Parameter File /data/App/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
- Listener Log File /data/App/oracle/diag/tnslsnr/DSJ-RTB-4T-349/listener/alert/log.xml
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.162.4.68)(PORT=2345)))
- (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...
- The command completed successfully
6, 更换主机并做连接测试
- [oracle@test02 ~]$ sqlplus scott/scott@10.162.4.68:2345/dwca
- SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 5 14:53:25 2018
- 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, OLAP, Data Mining and Real Application Testing options
- SQL>
来源: https://yq.aliyun.com/articles/700105