Oracle监听端口修改:解开秘藏的成功之门(修改oracle监听端口)

Oracle数据库是全球最受欢迎的关系型数据库.当需要进行Oracle系统维护时,调整Oracle监听端口是必不可少的一步。只有改变Oracle监听端口,才能让Oracle计算机安全、有效地开发和运行。本文介绍如何修改Oracle监听端口号,让读者可以在安全,有效,规范的情况下对Oracle监听端口进行修改。

首先,检查系统是否运行Oracle实例。打开控制台,输入命令lsnrctl status,查看监听端口列表信息:

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.2.0.2.0 - Produ
ation
Start Date 25-AUG-2012 15:27:17
Uptime 0 days 1 hr. 22 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File E:app123product11.2.0db_2NETWORKadminlistener.ora
Listener Log File e:app123diagloglistener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XXXXXXXX)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XXXXXXXX)(PORT=5500))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
...
The command completed successfully

查看当前运行的监听端口号,如在上面的例子中:1521为TNSListener的默认监听端口,5500为Oracle的HTTP监听端口。

第二步,修改Oracle监听端口号。首先需要修改tnsname.ora文件,在文件里查看Oracle E.Server所使用的非标准端口号,修改静态监听器编号:

Tnsping

其中,就是tnsname.ora文件中所提供的数据库名字,查出来的端口号就是监听端口号。

然后,打开并修改listener.ora文件。listener.ora文件是Oracle服务监控的核心文件,修改listener.ora文件必须指定新的监听端口号。例如,将1521端口修改为5000:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:app123product11.2.0db_2)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = E:app123product11.2.0db_2)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = XXXXXXXX)(PORT = 5000))
)
)

第三步,重启监听器。每当修改listener.ora文件后,都要重新启动监听器,使之生效:

LSNRCTL> stop

LSNRCTL> start

修改完成后,重新查看监听器端口,显示我们已经修改成功:

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.2.0.2.0 - Produ
ation
Start Date 25-AUG-2012 15:27:17
Uptime 0 days 2 hr. 10 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File E:app123product11.2.0db_2NETWORKadminlistener.ora
Listener Log File e:app123diagloglistener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XXXXXXXX)(PORT=5000)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XXXXXXXX)(PORT=5500))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
...
The command completed successfully

以上就是修改Oracle监听端口的全部过程,只要按照步骤操作即可修改成功.最后,要提醒的是,在修改之前要先确认当前是否有进程使用此端口,避免出现端口冲突。大家可根据实际情况,灵活调整Oracle监听端口,提高Oracle服务器的效率和安全性。


数据运维技术 » Oracle监听端口修改:解开秘藏的成功之门(修改oracle监听端口)