合 Oracle rac 修改SCAN IP信息
Tags: Oraclerac监听修改端口号remote_listenerSCAN IPlistener.oralocal_listener增加scan ip个数1521
- 修改SCAN主机名、端口号、增加scan ip的个数
- 示例:增加scan ip个数
- 修改rac的默认端口号为1522
- 检查
- How to Update the IP Address of the SCAN VIP Resources (ora.scan{n}.vip) (文档 ID 952903.1)
- APPLIES TO:
- GOAL
- SOLUTION
- How to Modify SCAN Setting or SCAN Listener Port after Installation (文档 ID 972500.1)
- APPLIES TO:
- GOAL
- SOLUTION
- A. To update SCAN setting
- B. To modify SCAN listener port
- REFERENCES
- 总结
修改SCAN主机名、端口号、增加scan ip的个数
在集群正常运行的情况下,首先修改所有节点/etc/hosts文件后,再执行如下命令,其中raclhr-scan是修改后的SCAN主机名:
1 2 3 4 5 6 7 | srvctl config scan srvctl stop scan_listener srvctl stop scan srvctl modify scan -n raclhr-scan srvctl config scan srvctl start scan srvctl start scan_listener |
如果SCAN IP的个数改变了,那么还需要执行如下命令进行更新:
1 | srvctl modify scan_listener -u |
需要注意的是,以上步骤也适用于修改SCAN的IP地址或增加SCAN IP的个数。
修改SCAN的端口号的命令如下所示:
1 | srvctl modify scan_listener -p 1522 |
示例:增加scan ip个数
对新配置的oracle RAC环境增配2个SCAN IP地址,192.168.59.175以及192.168.59.176。
配置前信息
默认情况下配置RA 只有1个scan IP,1个 scan listener。
查看scan的配置信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [root@raclhr-11gR2-N1 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 #Public IP 192.168.59.170 raclhr-11gR2-N1 192.168.59.171 raclhr-11gR2-N2 #Private IP 192.168.2.110 raclhr-11gR2-N1-priv 192.168.2.111 raclhr-11gR2-N2-priv #Virtual IP 192.168.59.172 raclhr-11gR2-N1-vip 192.168.59.173 raclhr-11gR2-N2-vip #Scan IP 192.168.59.174 raclhr-11gR2-scan [root@raclhr-11gR2-N1 ~]# srvctl config scan SCAN name: raclhr-11gR2-scan, Network: 1/192.168.59.0/255.255.255.0/eth0 SCAN VIP name: scan1, IP: /raclhr-11gR2-scan/192.168.59.174 |
查看scan的状态以及scan ip所处节点
1 2 3 4 5 6 7 | [root@raclhr-11gR2-N1 ~]# srvctl status scan SCAN VIP scan1 is enabled SCAN VIP scan1 is running on node raclhr-11gr2-n2 [root@raclhr-11gR2-N1 ~]# |
查看scan listener
1 2 3 4 5 | [root@raclhr-11gR2-N1 ~]# srvctl config scan_listener SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521 [root@raclhr-11gR2-N1 ~]# |
修改rac所有节点的/etc/hosts信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@raclhr-11gR2-N1 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 #Public IP 192.168.59.170 raclhr-11gR2-N1 192.168.59.171 raclhr-11gR2-N2 #Private IP 192.168.2.110 raclhr-11gR2-N1-priv 192.168.2.111 raclhr-11gR2-N2-priv #Virtual IP 192.168.59.172 raclhr-11gR2-N1-vip 192.168.59.173 raclhr-11gR2-N2-vip #Scan IP 192.168.59.174 raclhr-11gR2-scan 192.168.59.175 raclhr-11gR2-scan ----->>>>新增的SCAN IP 192.168.59.176 raclhr-11gR2-scan ----->>>>新增的SCAN IP |
停止scan 监听,注意先停监听才能停scan
1 2 3 4 5 6 7 8 9 | srvctl stop scan_listener srvctl stop scan srvctl status scan_listener srvctl status scan |
配置scan,注意需要用root权限执行
修改scan信息,-n 后面接 hosts中的san ip 网络名:
1 2 3 4 5 6 7 8 9 10 11 12 13 | [root@raclhr-11gR2-N1 ~]# srvctl modify scan -h Modifies the SCAN name. Usage: srvctl modify scan -n -n Domain name qualified SCAN name -h Print usage [root@raclhr-11gR2-N1 ~]# [root@raclhr-11gR2-N1 ~]# srvctl modify scan -n raclhr-11gR2-scan |
添加scanIP的监听,若不执行该命令srvctl modify scan_listener -u
,将只有一个listener_scan1监听,执行后将根据scan ip数自动增加listener_scan2,listener_scan3.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | [root@raclhr-11gR2-N1 ~]# srvctl modify scan_listener -h Modifies the SCAN listeners so that the number of SCAN listeners is the same as the number of SCAN VIPs or modifies the SCAN listener endpoints. Usage: srvctl modify scan_listener {-u|-p [TCP:][/IPC:][/NMP:][/TCPS:] [/SDP:]} -u Update SCAN listeners to match the number of SCAN VIPs -p [TCP:][/IPC:][/NMP:][/TCPS:] [/SDP:] SCAN Listener endpoints -h Print usage [root@raclhr-11gR2-N1 ~]# srvctl modify scan_listener -u [root@raclhr-11gR2-N1 ~]# [root@raclhr-11gR2-N1 ~]# crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ........ -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 OFFLINE OFFLINE ora.LISTENER_SCAN2.lsnr 1 OFFLINE OFFLINE ora.LISTENER_SCAN3.lsnr 1 OFFLINE OFFLINE ora.cvu 1 ONLINE ONLINE raclhr-11gr2-n1 ora.lhrrac1.db 1 ONLINE ONLINE raclhr-11gr2-n1 Open 2 ONLINE ONLINE raclhr-11gr2-n2 Open ora.oc4j 1 ONLINE ONLINE raclhr-11gr2-n1 ora.raclhr-11gr2-n1.vip 1 ONLINE ONLINE raclhr-11gr2-n1 ora.raclhr-11gr2-n2.vip 1 ONLINE ONLINE raclhr-11gr2-n2 ora.scan1.vip 1 OFFLINE OFFLINE ora.scan2.vip 1 OFFLINE OFFLINE ora.scan3.vip 1 OFFLINE OFFLINE |
启动scan
1 2 3 4 5 | srvctl start scan srvctl start scan_listener srvctl status scan srvctl status scan_listener srvctl config scan |
示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | [root@raclhr-11gR2-N1 ~]# srvctl start scan [root@raclhr-11gR2-N1 ~]# srvctl start scan_listener [root@raclhr-11gR2-N1 ~]# srvctl status scan SCAN VIP scan1 is enabled SCAN VIP scan1 is running on node raclhr-11gr2-n2 SCAN VIP scan2 is enabled SCAN VIP scan2 is running on node raclhr-11gr2-n1 SCAN VIP scan3 is enabled SCAN VIP scan3 is running on node raclhr-11gr2-n1 [root@raclhr-11gR2-N1 ~]# srvctl status scan_listener SCAN Listener LISTENER_SCAN1 is enabled SCAN listener LISTENER_SCAN1 is running on node raclhr-11gr2-n2 SCAN Listener LISTENER_SCAN2 is enabled SCAN listener LISTENER_SCAN2 is running on node raclhr-11gr2-n1 SCAN Listener LISTENER_SCAN3 is enabled SCAN listener LISTENER_SCAN3 is running on node raclhr-11gr2-n1 [root@raclhr-11gR2-N1 ~]# [root@raclhr-11gR2-N1 ~]# srvctl config scan SCAN name: raclhr-11gR2-scan, Network: 1/192.168.59.0/255.255.255.0/eth0 SCAN VIP name: scan1, IP: /raclhr-11gR2-scan/192.168.59.174 SCAN VIP name: scan2, IP: /raclhr-11gR2-scan/192.168.59.175 SCAN VIP name: scan3, IP: /raclhr-11gR2-scan/192.168.59.176 [root@raclhr-11gR2-N1 ~]# |
查看SCAN1和SCAN2的内容
重启集群环境后,可以看到如下内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | [root@raclhr-11gR2-N1 admin]# lsnrctl status listener_scan3 LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-JUN-2018 15:24:13 Copyright (c) 1991, 2011, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3))) STATUS of the LISTENER ------------------------ Alias LISTENER_SCAN3 Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production Start Date 05-JUN-2018 15:18:55 Uptime 0 days 0 hr. 5 min. 18 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/raclhr-11gR2-N1/listener_scan3/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.59.176)(PORT=1521))) Services Summary... Service "+ASM" has 2 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Instance "+ASM2", status READY, has 1 handler(s) for this service... Service "lhrrac1" has 2 instance(s). Instance "lhrrac11", status READY, has 1 handler(s) for this service... Instance "lhrrac12", status READY, has 1 handler(s) for this service... Service "lhrrac1XDB" has 2 instance(s). Instance "lhrrac11", status READY, has 1 handler(s) for this service... Instance "lhrrac12", status READY, has 1 handler(s) for this service... Service "lhrxxt" has 2 instance(s). Instance "lhrrac11", status READY, has 1 handler(s) for this service... Instance "lhrrac12", status READY, has 1 handler(s) for this service... The command completed successfully [root@raclhr-11gR2-N1 admin]# lsnrctl status listener_scan2 LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-JUN-2018 15:24:16 Copyright (c) 1991, 2011, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2))) STATUS of the LISTENER ------------------------ Alias LISTENER_SCAN2 Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production Start Date 05-JUN-2018 15:18:55 Uptime 0 days 0 hr. 5 min. 21 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/raclhr-11gR2-N1/listener_scan2/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.59.175)(PORT=1521))) Services Summary... Service "+ASM" has 2 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Instance "+ASM2", status READY, has 1 handler(s) for this service... Service "lhrrac1" has 2 instance(s). Instance "lhrrac11", status READY, has 1 handler(s) for this service... Instance "lhrrac12", status READY, has 1 handler(s) for this service... Service "lhrrac1XDB" has 2 instance(s). Instance "lhrrac11", status READY, has 1 handler(s) for this service... Instance "lhrrac12", status READY, has 1 handler(s) for this service... Service "lhrxxt" has 2 instance(s). Instance "lhrrac11", status READY, has 1 handler(s) for this service... Instance "lhrrac12", status READY, has 1 handler(s) for this service... The command completed successfully [root@raclhr-11gR2-N1 admin]# |
修改rac的默认端口号为1522
1 2 3 4 5 6 7 8 9 | srvctl config listener srvctl modify listener -p 1522 srvctl stop listener srvctl start listener alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.20.7.83)(PORT=1522)))' sid='rac1'; alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.20.7.84)(PORT=1522)))' sid='rac2'; alter system set remote_listener='rac-scan:1522' sid='*'; alter system register; |
检查
1 2 3 4 5 6 | ps -ef|grep tns netstat -tulnp | grep 152 crsctl stat res -t lsnrctl status lsnrctl status listener_scan |
How to Update the IP Address of the SCAN VIP Resources (ora.scan{n}.vip) (文档 ID 952903.1)
APPLIES TO:
Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.
GOAL
The purpose of this document is to explain how to change the IP addresses associated with the VIPs in a 11gR2 Grid (CRS) environment.
The IP addresses associated with the SCAN VIP resources are initially set when the SCAN resources are created.
Any changes to the DNS entry for the SCAN are not automatically propagated to the clusterware and need to be done manually.
This applies only to installations that are not using .
The information in this note can also be helpful in cases where SCAN was originally configured with just one address and is now being expanded to accommodate three IP addresses.
SOLUTION
Before the SCAN VIPs can be changed, the entry for the SCAN name on the Domain Name Server (DNS) needs to be updated with the new IP addresses. This usually will be done by a network administrator. To check the current setting, the following command can be used:
nslookup
\ To check the current IP address(es) of the SCAN VIPs, run the following commands as the root user:
$GRID_HOME/bin/srvctl config scan
Stop the SCAN listeners and SCAN
$GRID_HOME/bin/srvctl stop scan_listener
$GRID_HOME/bin/srvctl stop scan本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!