修改oracle默认监听端口

简介: 主要是修改两个文件和修改oracle参数local_listener 1 查看当前监听状态 [oracle@test ~]$ lsnrctl status LSNRCTL for Linux: Version 11.

主要是修改两个文件和修改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>
目录
相关文章
|
3月前
|
网络协议 Linux
Linux查看端口监听情况,以及Linux查看某个端口对应的进程号和程序
Linux查看端口监听情况,以及Linux查看某个端口对应的进程号和程序
634 2
|
3月前
|
开发框架 .NET Linux
【Azure 应用服务】 部署到App Service for Linux 服务的Docker 镜像,如何配置监听端口呢?
【Azure 应用服务】 部署到App Service for Linux 服务的Docker 镜像,如何配置监听端口呢?
|
4月前
|
人工智能 Serverless API
函数计算产品使用问题之如何在一个Docker容器内运行一个持续监听特定端口的应用程序
函数计算产品作为一种事件驱动的全托管计算服务,让用户能够专注于业务逻辑的编写,而无需关心底层服务器的管理与运维。你可以有效地利用函数计算产品来支撑各类应用场景,从简单的数据处理到复杂的业务逻辑,实现快速、高效、低成本的云上部署与运维。以下是一些关于使用函数计算产品的合集和要点,帮助你更好地理解和应用这一服务。
|
3月前
|
网络协议
【qt】TCP的监听 (设置服务器IP地址和端口号)
【qt】TCP的监听 (设置服务器IP地址和端口号)
204 0
|
3月前
|
Linux Windows
Windows查找监听端口对应的进程及其路径
Windows查找监听端口对应的进程及其路径
111 0
|
5月前
|
Java Android开发
Java Socket编程示例:服务器开启在8080端口监听,接收客户端连接并打印消息。
【6月更文挑战第23天】 Java Socket编程示例:服务器开启在8080端口监听,接收客户端连接并打印消息。客户端连接服务器,发送"Hello, Server!"后关闭。注意Android中需避免主线程进行网络操作。
100 4
|
5月前
|
SQL Oracle 关系型数据库
改变Oracle数据库连接端口
改变Oracle数据库连接端口
88 4
|
4月前
|
弹性计算 应用服务中间件 Linux
阿里云服务器开放端口完整图文教程
笔者近期开发完成的服务端程序部署在阿里云的ECS云服务器上面,一些应用程序配置文件需要设置监听的端口(如Tomcat的8080、443端口等),虽然通过CentOs 7系统的的「防火墙」开放了对应的端口号,任然无法访问端口号对应的应用程序,后面了解到原来还需要设置云服务器的「安全组规则」,开放相应的端口权限,服务端的接口才能真正开放。
687 1
阿里云服务器开放端口完整图文教程
|
4月前
|
弹性计算 运维 数据安全/隐私保护
云服务器 ECS产品使用问题之如何更改服务器的IP地址或端口号
云服务器ECS(Elastic Compute Service)是各大云服务商阿里云提供的一种基础云计算服务,它允许用户租用云端计算资源来部署和运行各种应用程序。以下是一个关于如何使用ECS产品的综合指南。
|
3月前
|
缓存 NoSQL 网络安全
【Azure Redis 缓存】使用开源工具redis-copy时遇见6379端口无法连接到Redis服务器的问题
【Azure Redis 缓存】使用开源工具redis-copy时遇见6379端口无法连接到Redis服务器的问题