Oracle 11gR2 RAC 修改监听器端口号的步骤

时间:2022-12-04 07:45:23

Oracle  11gR2 RAC 修改监听器端口号的步骤

参考自:
Changing Listener Ports On RAC/EXADATA (文档 ID 1473035.1)

注意:
1.本文的os是RHEL6.5,DB版本是11.2.0.3.8。
   本文非exadata环境,若是Exadata环境,请读Changing Listener Ports On RAC/EXADATA (文档 ID 1473035.1)
2.本文修改了如下监听器的端口号,改为1528
  集群监听器的端口号
  节点1本地监听器的端口号
  节点2本地监听器的端口号
3.根据 Changing Listener Ports On RAC/EXADATA (文档 ID 1473035.1),需要在a quiet time来修改监听器端口号

修改前的检查

[grid@hosta admin]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
[grid@hosta admin]$ 

1.仅仅在一个主机上执行

[grid@hosta admin]$ srvctl modify listener -l LISTENER -p "TCP:1528"

2.仅仅在一个主机上执行

[grid@hosta ~]$ srvctl modify scan_listener -p 1528

3.修改LOCAL_LISTENER仅仅在一个主机上执行

alter system set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.188.183)(PORT = 1528))' scope=both  sid='orcl1';
alter system set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.188.184)(PORT = 1528))' scope=both  sid='orcl2';

4.修改remote_listener

alter system set remote_listener='orcl-scan:1528' scope=both;

5.
在第一个节点关闭本地监听

[grid@hosta ~]$ srvctl stop listener -l LISTENER -n hosta

修改第一个节点的$GI_HOME/network/admin/endpoints_listener.ora文件,将1521改为1528

[grid@hosta admin]$ cat listener.ora--->该文件中不存储端口号,因此不用修改。
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))  # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))  # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON  # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON  # line added by Agent
[grid@hosta admin]$ cat endpoints_listener.ora --->该文件中存储端口号,修改本文件即可。
LISTENER_HOSTA=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hosta-vip)(PORT=1528))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.188.181)(PORT=1528)(IP=FIRST))))  # line added by Agent
[grid@hosta admin]$ 


启动第一个节点本地监听

[grid@hosta admin]$ srvctl start listener -l LISTENER -n hosta

在第二个节点上进行相同的操作。

[grid@hostb ~]$ srvctl stop listener -l LISTENER -n hostb

修改endpoints_listener.ora文件,不再贴出
[grid@hostb admin]$ srvctl start listener -l LISTENER -n hostb

6.确认修改效果

[grid@hostb admin]$ srvctl config Listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1528

之后,应用程序连接串以及dblink的定义修改端口号,启动业务进行测试即可。