首页 > 代码库 > Oracle 12c RAC 修改SCAN 配置
Oracle 12c RAC 修改SCAN 配置
注:本文谢绝转载!
关于RAC 的SCAN 的理论说明,参考如下链接:
Oracle RAC 集群 SCAN 说明
http://blog.csdn.net/tianlesoftware/article/details/42712979
Oracle 12c RAC 集群使用DNS 实现 SCAN
http://blog.csdn.net/tianlesoftware/article/details/42917867
这篇blog 看下12c中对SCAN 的修改,修改包括2个方面:
(1) 修改SCAN 的名称。
(2) 修改SCAN 的IP 地址。
如果使用的是/etc/hosts里的SCAN,那么只需要修改hosts文件就可以,如果使用DNS的,就需要从DNS 来修改,我这里使用DNS的RAC环境,所以修改DNS为例,进行示范。
另外,修改会停止SCAN,所以如果数据库是用SCAN 连链接的,就需要停部分操作,这部分可以转换到用VIP连链接,修改期间,数据库可以正常运行,其他操作不受影响。
1 当前环境
[grid@rac1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM.lsnr ora....er.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac2
ora....N2.lsnr ora....er.type ONLINE ONLINE rac1
ora....N3.lsnr ora....er.type ONLINE ONLINE rac1
ora.MGMTLSNR ora....nr.type ONLINE ONLINE rac1
ora.OCR.dg ora....up.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.mgmtdb ora....db.type ONLINE ONLINE rac1
ora....network ora....rk.type ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type ONLINE ONLINE rac1
ora.ons ora.ons.type ONLINE ONLINE rac1
ora.proxy_advm ora....vm.type ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora.scan1.vip ora....ip.type ONLINE ONLINE rac2
ora.scan2.vip ora....ip.type ONLINE ONLINE rac1
ora.scan3.vip ora....ip.type ONLINE ONLINE rac1
[grid@rac1 ~]$ srvctl config scan
SCAN name: scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 0 IPv4 VIP: 192.168.56.21
SCAN name: scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 1 IPv4 VIP: 192.168.56.22
SCAN name: scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 2 IPv4 VIP: 192.168.56.20
[grid@rac1 ~]$
这里是2个节点的RAC 集群。
SCAN 名称是:scan.cndba.cn
3个SCAN IP:
192.168.56.20
192.168.56.21
192.168.56.22
2 修改SCAN
2.1 停止SCAN
[grid@rac1 ~]$ srvctl stop scan_listener
[grid@rac1 ~]$ srvctl stop scan
[grid@rac1 ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is not running
SCAN VIP scan2 is enabled
SCAN VIP scan2 is not running
SCAN VIP scan3 is enabled
SCAN VIP scan3 is not running
2.2 修改SCAN 信息
这里我们修改SCAN 名称和IP 地址。
这里将SCAN 名称从SCAN 修改成cndba-scan.
IP 地址修改成:
192.168.56.30
192.168.56.31
192.168.56.32
关于SCAN的修改,参考如下链接:
Oracle 12c RAC 集群使用DNS 实现 SCAN
http://blog.csdn.net/tianlesoftware/article/details/42917867
修改之后,如下:
[grid@rac1 grid]$ nslookupcndba-scan.cndba.cn
Server: 192.168.56.200
Address: 192.168.56.200#53
Name: cndba-scan.cndba.cn
Address: 192.168.56.30
Name: cndba-scan.cndba.cn
Address: 192.168.56.31
Name: cndba-scan.cndba.cn
Address: 192.168.56.32
[grid@rac2 ~]$ nslookup cndba-scan.cndba.cn
Server: 192.168.56.200
Address: 192.168.56.200#53
Name: cndba-scan.cndba.cn
Address: 192.168.56.31
Name: cndba-scan.cndba.cn
Address: 192.168.56.32
Name: cndba-scan.cndba.cn
Address: 192.168.56.30
2.3 执行修改操作
用root用户执行如下操作。
[grid@rac1 ~]$ which srvctl
/u01/gridsoft/12.1.0/bin/srvctl
[grid@rac1 ~]$ which crsctl
/u01/gridsoft/12.1.0/bin/crsctl
[root@rac1 /]# /u01/gridsoft/12.1.0/bin/srvctlmodify scan -n cndba-scan.cndba.cn
[grid@rac1 ~]$ srvctl config scan
SCAN name: cndba-scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 0 IPv4 VIP: 192.168.56.30
SCAN name: cndba-scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 1 IPv4 VIP: 192.168.56.31
SCAN name: cndba-scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 2 IPv4 VIP: 192.168.56.32
[grid@rac1 ~]$
看上去,一切都ok了,实际上,并没有,我们还SCAN_VIP的属性:
[grid@rac1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
…
ora.scan1.vip ora....ip.type OFFLINE OFFLINE
ora.scan2.vip ora....ip.type OFFLINE OFFLINE
ora.scan3.vip ora....ip.type OFFLINE OFFLINE
[grid@rac1 ~]$ crsctl stat res ora.scan3.vip-p
NAME=ora.scan3.vip
TYPE=ora.scan_vip.type
ACL=owner:root:rwx,pgrp:root:r-x,other::r--,group:oinstall:r-x,user:grid:r-x
ACTIONS=
…
RESTART_ATTEMPTS=0
SCAN_NAME=scan.cndba.cn
SCRIPT_TIMEOUT=60
SERVER_CATEGORY=ora.hub.category
…
USR_ORA_VIP=192.168.56.20
VERSION=12.1.0.1.0
[grid@rac1 ~]$
[grid@rac1 ~]$ crsctl stat resora.scan3.vip
NAME=ora.scan3.vip
TYPE=ora.scan_vip.type
TARGET=OFFLINE
STATE=OFFLINE
所以我们,我们要修改type里的信息。
用root用户执行:
[root@rac1 /]#/u01/gridsoft/12.1.0/bin/crsctl modify type ora.scan_vip.type -attr"ATTRIBUTE=SCAN_NAME,DEFAULT_VALUE=http://www.mamicode.com/cndba-scan.cndba.cn"
[root@rac1 /]#
这次就全变了:
[grid@rac1 ~]$ crsctl stat res ora.scan3.vip -p
NAME=ora.scan3.vip
TYPE=ora.scan_vip.type
…
SCAN_NAME=cndba-scan.cndba.cn
…
USR_ORA_VIP=192.168.56.32
VERSION=12.1.0.1.0
至此,修改完成。
2.4 启动SCAN
用grid用户操作:
[grid@rac1 ~]$ srvctl start scan
[grid@rac1 ~]$ srvctl start scan_listener
2.5 验证
[grid@rac2 ~]$ srvctl config scan
SCAN name: cndba-scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 0 IPv4 VIP: 192.168.56.30
SCAN name: cndba-scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 1 IPv4 VIP: 192.168.56.31
SCAN name: cndba-scan.cndba.cn, Network: 1
Subnet IPv4:192.168.56.0/255.255.255.0/eth0
Subnet IPv6:
SCAN 2 IPv4 VIP: 192.168.56.32
[grid@rac2 ~]$
[grid@rac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server Statedetails
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.OCR.dg
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.net1.network
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.ons
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
ora.proxy_advm
ONLINE ONLINE rac1 STABLE
ONLINE ONLINE rac2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2 STABLE
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE rac1 STABLE
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE rac1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE rac1 169.254.95.238 192.1
68.57.5,STABLE
ora.asm
1 ONLINE ONLINE rac1 STABLE
2 ONLINE ONLINE rac2 STABLE
3 OFFLINE OFFLINE STABLE
ora.cvu
1 ONLINE ONLINE rac1 STABLE
ora.mgmtdb
1 ONLINE ONLINE rac1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE rac1 STABLE
ora.rac1.vip
1 ONLINE ONLINE rac1 STABLE
ora.rac2.vip
1 ONLINE ONLINE rac2 STABLE
ora.scan1.vip
1 ONLINE ONLINE rac2 STABLE
ora.scan2.vip
1 ONLINE ONLINE rac1 STABLE
ora.scan3.vip
1 ONLINE ONLINE rac1 STABLE
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
版权所有,文章禁止转载,否则追究法律责任!
AboutDave:
--------------------------------------------------------------------------------------------
QQ: 251097186
Email: tianlesoftware@gmail.com
Blog: http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
Linkedin: http://cn.linkedin.com/in/tianlesoftware
Dave 的QQ群:
--------------------------------------------------------------------------------------------
注意:加群必须注明表空间和数据文件关系 | 不要重复加群
CNDBA_1: 62697850 (空) CNDBA_2: 62697716 (满) CNDBA_3: 283816689
CNDBA_4: 391125754 CNDBA_5:104207940 CNDBA_6: 62697977 CNDBA_7: 142216823(满)
Oracle 12c RAC 修改SCAN 配置