环境
DB:19.3.0.0
OS:Centos 7
1.查看当前的监听配置
在其中一个节点上执行,我这里是在节点1上执行
[grid@rac01 ~]$ srvctl config listener -l listener
Name: LISTENER
Type: Database Listener
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
2.修改端口
仅在其中一个节点上执行,我这里是在节点1上执行
[grid@rac01 admin]$ srvctl modify listener -l LISTENER -p "TCP:1522"
3.修改scan
仅在其中一个节点上执行,我这里是在节点1上执行
[grid@rac01 admin]$ srvctl modify scan_listener -p 1522
4.重启动监听,(不需要重启,数据库自动会应用新的端口)
仅在节点1上执行
[grid@rac01 admin]$ srvctl stop listener -l listener
[grid@rac01 admin]$ srvctl stop scan_listener
[grid@rac01 admin]$ srvctl start listener -l listener
[grid@rac01 admin]$ srvctl start scan_listener
5.检查状态
在scan所在的节点执行
[grid@rac02 ~]$ lsnrctl status LISTENER_SCAN1
节点1和节点2都执行
[grid@rac02 ~]$ lsnrctl status listener
6.修改asm配置文件
系统自动检查,自动修改的
节点1:
SQL> connect / as sysasm
Connected.
SQL> set linesize 1000;
SQL> show parameters local_listener
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.201)(PORT=1522))
节点2:
SQL> show parameters local_listener;
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.202)(PORT=1522))
7.安装了数据库的需要修改数据库参数,(不需要修改,数据库自动会应用新的端口)
登录数据库实例,仅在其中一个实例执行
alter system set remote_listener='rac-scan:1522' scope=both;
修改LOCAL_LISTENER仅仅在一个主机上执行
alter system set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.201)(PORT = 1522))' scope=both sid='slnngk1';
alter system set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.202)(PORT = 1522))' scope=both sid='slnngk2';
--------------------------------------------------修改asm网络端口----------------------------------------------
1.查看
在其中一个节点上执行,我这里是在节点1上执行
[grid@rac01 admin]$ srvctl config listener -listener ASMNET1LSNR_ASM
Name: ASMNET1LSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 10.10.10.0
Home: <CRS home>
End points: TCP:1525
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
2.修改端口
grid用户在其中一个节点上执行,我这里是在节点1上执行
srvctl modify listener -l ASMNET1LSNR_ASM -endpoints "TCP:1526"
修改完成后系统自动修改端口号,不需要下面的重启步骤
[grid@rac01 admin]$ ss -nlp|grep 1526
tcp LISTEN 0 128 10.10.10.1:1526 *:* users:(("tnslsnr",pid=32245,fd=15))
[grid@rac02 ~]$ ss -nlp|grep 1526
tcp LISTEN 0 128 10.10.10.2:1526 *:* users:(("tnslsnr",pid=8106,fd=15))
3.重启动(不需要)
srvctl stop listener -l ASMNET1LSNR_ASM -force (只能停掉一个节点)
srvctl start listener -l ASMNET1LSNR_ASM