欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

修改oracle数据库监听端口号

程序员文章站 2022-05-25 15:38:20
...

oracle默认端口号是1521.很容易就被黑客扫描到然后天天惦记你的数据库 所以修改默认端口号就很有必要了 1、首先查看监听状态 lsnrctl status 2、关闭监听 lsnrctl stop 3、修改监听文件1521====10001 SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (ORACLE_H

oracle默认端口号是1521.很容易就被黑客扫描到然后天天惦记你的数据库

所以修改默认端口号就很有必要了

1、首先查看监听状态

lsnrctl status

2、关闭监听

lsnrctl stop

3、修改监听文件1521====>10001

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /u01/11g)
(SID_NAME = pu)
)
)


LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = target)(PORT = 10001))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)


ADR_BASE_LISTENER = /u01/oracle


4、登陆数据库修改local_listenner



SQL> show parameter local_listener


NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
local_listener string


VALUES值为空


修改local_listener参数

SQL> show parameter local_liste


NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
local_listener string


SQL> alter system set local_listener="(address = (protocol = tcp)(host = target)
2 (port = 10001))";


System altered.


SQL> show parameter local_lis


NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
local_listener string
(address = (protocol = tcp)(ho
st = target)
(port = 10001))


5、启动监听

[oracle@target ~]$ lsnrctl start


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-MAY-2016 16:48:35


Copyright (c) 1991, 2011, Oracle. All rights reserved.


Starting /u01/11g/bin/tnslsnr: please wait...


TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/11g/network/admin/listener.ora
Log messages written to /u01/oracle/diag/tnslsnr/target/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=target)(PORT=10001)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=target)(PORT=10001)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 10-MAY-2016 16:48:36
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/11g/network/admin/listener.ora
Listener Log File /u01/oracle/diag/tnslsnr/target/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=target)(PORT=10001)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "pu" has 1 instance(s).
Instance "pu", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

6、查看系统状态

[oracle@target ~]$ netstat -ano|grep 10001
tcp 0 0 192.168.6.152:26082 192.168.6.152:10001 ESTABLISHED off (0.00/0/0)
tcp 0 0 :::10001 :::* LISTEN off (0.00/0/0)
tcp 0 0 ::ffff:192.168.6.152:10001 ::ffff:192.168.6.152:26082 ESTABLISHED keepalive (7193.37/0/0)

已经开启10001端口号


7、验证登陆

[oracle@target ~]$ sqlplus / as sysdba@target:10001:pu


SQL*Plus: Release 11.2.0.3.0 Production on Tue May 10 16:50:50 2016


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




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options


SQL>