设为首页 加入收藏

TOP

修改Oracle默认监听端口(一)
2017-01-20 08:15:11 】 浏览:363
Tags:修改 Oracle 默认 监听

至此,监听端口已经修改完毕,这时Oracle实例是无法注册到此监听上的。
2、修改LOCAL_LISTINER参数
#修改参数
sys@ORCL>alter system set local_listener="(address = (protocol = tcp)(host = rhel6)(port = 2521))";
?
System altered.
#查看监听状态
[oracle@rhel6 ~]$ lsnrctl status
?
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-JAN-2017 20:23:10
?
Copyright (c) 1991, 2013, Oracle.? All rights reserved.
?
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=2521)))
STATUS of the LISTENER
------------------------
Alias? ? ? ? ? ? ? ? ? ? LISTENER
Version? ? ? ? ? ? ? ? ? TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date? ? ? ? ? ? ? ? 07-JAN-2017 20:19:11
Uptime? ? ? ? ? ? ? ? ? ? 0 days 0 hr. 3 min. 59 sec
Trace Level? ? ? ? ? ? ? off
Security? ? ? ? ? ? ? ? ? ON: Local OS Authentication
SNMP? ? ? ? ? ? ? ? ? ? ? OFF
Listener Parameter File? /u02/app/oracle/product/11.2.4/db1/network/admin/listener.ora
Listener Log File? ? ? ? /u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xml
Listening Endpoints Summary...
? (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=2521)))
? (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "orcl" has 1 instance(s).
? Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully


修改完后,可以看到数据库实例立即注册到监听器上。
3、使用新端口进行测试连接
[c:\~]$ sqlplus zx/zx@192.168.56.2:2521/orcl
?
SQL*Plus: Release 12.1.0.1.0 Production on 星期六 1月 7 20:24:17 2017
?
Copyright (c) 1982, 2013, Oracle.? All rights reserved.
?
?
连接到:?
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
?
SQL>


修改监听端口完成。
4、把Oracle实例的注册端口改回1521
sys@ORCL>alter system set local_listener='';
?
System altered.


官方文档中还提供了另一种配置LOCAL_LISTINER的方法:
在tnsnames.ora中添加配置,然后配置LOCAL_LISTINER为tnsnames.ora中的名字即可
#配置tnsnames.ora
[oracle@rhel6 admin]$ vi tnsnames.ora?
listener1=(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.56.2 )(PORT = 2521))
#修改LOCAL_LISTINER参数
sys@ORCL>alter system set local_listener=listener1;
?
System altered.
#查看监听状态
[oracle@rhel6 ~]$ lsnrctl status
?
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-JAN-2017 20:34:01
?
Copyright (c) 1991, 2013, Oracle.? All rights reserved.
?
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=2521)))
STATUS of the LISTENER
------------------------
Alias? ? ? ? ? ? ? ? ? ? LISTENER
Version? ? ? ? ? ? ? ? ? TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date? ? ? ? ? ? ? ? 07-JAN-2017 20:31:28
Uptime? ? ? ? ? ? ? ? ? ? 0 days 0 hr. 2 min. 33 sec
Trace Level? ? ? ? ? ? ? off
Security? ? ? ? ? ? ? ? ? ON: Local OS Authentication
SNMP? ? ? ? ? ? ? ? ? ? ? OFF
Listener Parameter File? /u02/app/oracle/product/11.2.4/db1/network/admin/listener.ora
Listener Log File? ? ? ? /u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xml
Listening Endpoints Summary...
? (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=2521)))
? (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "orcl" has 1 instance(s).
? Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully


另外还可以使用静态监听的方法来修改监听的端口,但是Oracle实例不是“主动”注册到监听器上的。
sys@ORCL>show parameter local_listener
?
NAME? ? ? ? ? ? ? ? ? ? TYPE? ? ? ? ? ? ? ? VALUE
------------------------------------ --------------------------------- ------------------------------
local_listener? ? ? ? ? ? ? string
#修改监听为

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Oracle虚拟索引 下一篇Oracle 用户及权限设置

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目