大多数现场集群都采用的是默认端口,现XX现场客户领导要求不使用默认端口,以下是修改监听端口的步骤,配置过程中若有疑问可添加文末公众号发私信一对一答疑解惑。
一.修改SCAN listener port
1.1 修改SCAN listener port
1.1.1.crs配置中修改SCAN listener port
--切换到grid用户
su - grid
--修改前查看SCAN listener 状态
[grid@orcl01:/home/grid]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node orcl01
--修改前查看SCAN listener 配置信息
[grid@orcl01:/home/grid]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
--修改成新的端口 1个节点更改所有节点生效
[grid@orcl01:/home/grid]$ srvctl modify scan_listener -p 1522
1.1.2.数据库中修改SCAN listener port
--切换到oracle用户
su - oracle
sqlplus / as sysdba
--修改前查看
SQL> set linesize 100
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=
192.168.40.202)(PORT=1521))
remote_listener string orcl-scan:1521
--更改SCAN listener port
SQL> alter system set remote_listener='orcl-scan:1522' sid='*' scope=both;
System altered.
--更改后查看
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=
192.168.40.202)(PORT=1521))
remote_listener string orcl-scan:1522
1.1.3 重启SCAN listener生效新端口
--切换到grid用户
su - grid
--重启SCAN listener生效新端口
[grid@orcl01:/home/grid]$ srvctl stop scan_listener
[grid@orcl01:/home/grid]$ srvctl start scan_listener
1.1.4 确认更改
--切换到grid用户
su - grid
[grid@orcl01:/home/grid]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1522
二.修改Listener Ports
2.1 获取当前监听程序的配置信息
--切换到grid用户
su - grid
--查看当前监听程序的配置信息
[grid@orcl01:/home/grid]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
2.2 crs中修改LOCAL_LISTENER
--切换到grid用户
su - grid
--手工修改LOCAL_LISTENER 1个节点更改所有节点生效
[grid@orcl01:/home/grid]$ srvctl modify listener -l LISTENER -p "TCP:1522"
--修改后查看当前监听程序的配置信息
[grid@orcl01:/home/grid]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1522
2.3.数据库中修改LOCAL_LISTENER
2.3.1.修改前查看LOCAL_LISTENER
节点1和节点2的ip地址分别对应vip
--切换到oracle用户
su - oracle
sqlplus / as sysdba
--修改前查看 节点1
SQL> set linesize 100
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=
192.168.40.202)(PORT=1521))
remote_listener string orcl-scan:1522
----修改前查看 节点2
SQL> set linesize 100
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=
192.168.40.203)(PORT=1521))
remote_listener string orcl-scan:1522
2.3.2.更改LOCAL_LISTENER
--切换到oracle用户
su - oracle
sqlplus / as sysdba
--更改LOCAL_LISTENER
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.40.201)(PORT=1522))))' scope=both sid='dxj1';
System altered.
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.40.203)(PORT=1522))))' scope=both sid='dxj2';
System altered.
2.3.3.修改后查看LOCAL_LISTENER
节点1和节点2的ip地址分别对应vip
--切换到oracle用户
su - oracle
sqlplus / as sysdba
--修改后查看 节点1
SQL> set linesize 100
SQL> show parameter listener
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=192.
168.40.201)(PORT=1522))))
remote_listener string orcl-scan:1522
----修改后查看 节点2
SQL> set linesize 100
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=192.
168.40.203)(PORT=1522))))
remote_listener string orcl-scan:1522
2.4 重新启动监听程序
监听重新启动后,对应配置文件才会更改。
--切换到grid用户
su - grid
--重新启动监听程序 1个节点操作即可
[grid@orcl01:/home/grid]$ srvctl stop listener
[grid@orcl01:/home/grid]$ srvctl start listener
2.5 检查配置后的监听程序的配置信息
[grid@orcl01:/home/grid]$ srvctl config Listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1522