看下12c中對SCAN 的修改,修改包括2個方面:
(1) 修改SCAN 的名稱。
(2) 修改SCAN 的IP 地址。
如果使用的是/etc/hosts裡的SCAN,那麼只需要修改hosts文件就可以,如果使用DNS的,就需要從DNS 來修改,我這裡使用DNS的RAC環境,所以修改DNS為例,進行示范。
另外,修改會停止SCAN,所以如果數據庫是用SCAN 連鏈接的,就需要停部分操作,這部分可以轉換到用VIP連鏈接,修改期間,數據庫可以正常運行,其他操作不受影響。
[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
[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
這裡我們修改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
用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=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
至此,修改完成。
用grid用戶操作:
[grid@rac1 ~]$ srvctl start scan
[grid@rac1 ~]$ srvctl start scan_listener
[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
--------------------------------------------------------------------------------