修改oracle监听端口(主备库一样的),不用关闭数据库
修改端口号的整体步骤:
1.1
查看当前监听的状态
1.2
停止监听
1.3
修改监听文件的端口号
1.4 修改初始化参数local_listener
1.5
重启监听器
1.6
修改完毕,使用新端口登录测试
实践步骤:
主库:
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=1521)))
The command completed successfully
1.3修改监听文件的端口号
把端口号修改为1530,分别修改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
# listener.ora Network Configuration File: /usr/opt/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
LISTENER =
[test@ASI-1~]$vi tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
EXTPROC_CONNECTION_DATA =
1.4 修改初始化参数local_listener
[test@ASI-1~]$sqlplus / as sysdba
SQL*Plus:Release 10.2.0.1.0 - Production on 星期六 7月 19 13:24:02 2008
Copyright (c)1982, 2005, Oracle.
All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> show parameter local_listener
NAME
TYPE
VALUE
------------------------------------ ----------- ------------------------------
local_listener
string
(address=(protocol=tcp)(host=s
kate)(port=1521))
SQL> alter system set local_listener="(address=(protocol=tcp)(host=192.168.0.100)(port=1530))";
value值也可能为空,这个不用管
系统已更改。
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=1530)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1530)))
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/listener.ora
Listener Log File
/usr/opt/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Service "orcl" has 1 instance(s).
The command completed successfully
1.6使用新端口登录测试
1.6.1 检查监听端口是否改变
[test@ASI-1~]$netstat -na | grep "1530"
tcp
0
0 192.168.0.100:1530
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=1530)))
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...
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Service "orcl" has 1 instance(s).
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 = 1530))) (CONNECT_DATA = (SERVICE_NAME = orcl)))
OK (0 msec)
备库的:
基本和主库一样,修改端口为1530和对应的host值,修改完后看一下归档是否可以同步过来