分享

修改Oracle监听端口

 Java技术馆 2012-07-02

修改Oracle监听端口

修改oracle监听端口

修改端口号的整体步骤:

1.1   查看当前监听的状态

1.2   停止监听

1.3   修改监听文件的端口号

1.4   修改初始化参数local_listener

1.5   重启监听器

1.6   修改完毕,使用新端口登录测试

1.7   重新配置db control

实践步骤:

1.1 查看当前监听的状态

[test@ASI-1 ~]$lsnrctl status

 

1.2 停止监听

[test@ASI-1~]$lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-MAR-2011 16:36:49

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

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1523)))

The command completed successfully

 

1.3修改监听文件的端口号

把端口号修改为1521,分别修改listener.ora和tnsname.ora文件

[test@ASI-1 ~]$ cd/usr/opt/oracle/product/10.2.0/db_1/network/admin/

[test@ASI-1 admin]$ pwd

/usr/opt/oracle/product/10.2.0/db_1/network/admin

[test@ASI-1~]$vi  listener.ora

[test@ASI-1~]$vi tnsnames.ora

1.4 修改初始化参数local_listener

local_listener默认是不设的。不过要是不用1521端口的话(默认为:1521),有时用工具连数据库的时候老是链接不上。必须要重新连接很多次。设置了local_listener就好啦。

[test@ASI-1~]$sqlplus / as sysdba

SQL> show parameter local_listener

NAME                                TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                      string      (address=(protocol=tcp)(host=s
kate)(port=1523))


SQL> alter system set local_listener="(address=(protocol=tcp)(host=127.0.0.1)(port=1521))";

系统已更改。

1.5 重启监听器

[test@ASI-1~]$lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-MAR-2011 17:56:42

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

Starting /usr/opt/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production

System parameter file is /usr/opt/oracle/product/10.2.0/db_1/network/admin/liste

ner.ora

Log messages written to /usr/opt/oracle/product/10.2.0/db_1/network/log/listener

.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.100)(PORT=1521

)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1521

)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                11-MAR-2011 17:56:42

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /usr/opt/oracle/product/10.2.0/db_1/network/admin/list

ener.ora

Listener Log File         /usr/opt/oracle/product/10.2.0/db_1/network/log/listen

er.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.100)(PORT=1521)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl" has 1 instance(s).

  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully


1.6使用新端口登录测试

1.6.1 检查监听端口是否改变

[test@ASI-1~]$netstat -na | grep "1521"

tcp       0     0 192.168.0.100:1521         0.0.0.0:*       LISTEN

1.6.2  查看监听器的状态

[test@ASI-1~]$lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-MAR-2011 18:21:04

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                11-MAR-2011 17:56:42

Uptime                    0 days 0 hr. 24 min. 21 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /usr/opt/oracle/product/10.2.0/db_1/network/admin/listener.ora

Listener Log File         /usr/opt/oracle/product/10.2.0/db_1/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.100)(PORT=1521)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl" has 1 instance(s).

  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

1.6.3 [test@ASI-1 ~]$tnsping orcl

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 11-MAR-2011 18:34:36

Copyright (c) 1997, 2005, Oracle.  All rights reserved.

Used parameter files:

/usr/opt/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))

OK (0 msec)



1.7重新配置db control

如果修改了监听的名字和端口,比如说从1523修改到了1521,那么db control是肯定需要重新配置的,大致步骤如下:

emctl stop dbconsole

删除原来的db control和repository知识库                                                                                                                

emca -deconfig dbcontrol db -repos drop -cluster     或者   emca -config dbcontrol db

这里需要输入相关的数据库信息

emctl start dbconsole



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多