crsctl query crs activeversion 查看版本
ocrconfig -showbackup auto 查看自动备份的目录
ocrconfig -export /home/oracle/ocr.backup 逻辑ocr备份
ocrconfig –import /shared/export/ocrback.dmp 逻辑恢复
/oracle/app/grid/product/11.2.0/bin/ocrconfig -manualbackup root权限进行备份ocr
恢复 ocrconfig -restore backup00.ocr 物理恢复
ocrconfig -showbackup manual查看手动备份的位置
cluvfy comp ocr -n all 可以检查OCR的可用性同时包含OCR配置的文件/etc/oracle/ocr.loc
ocrcheck -local 查看olr root权限
oifcfg getif 查看配置的接口
srvctl config nodeapps -a 查看虚拟IP信息
cluvfy comp nodecon -n all -verbose 检查节点的连通性
crsctl status serverpool -f 查看server pool属性
crsctl status server -f 查看当前节点有效的server pool
srvctl modify srvpool -g SP2 –l 4 –u 8 –i 7
节点2 crsctl disable crs
重启
使用ps -ef | grep d.bin
确定CRS服务没启动
crsctl disable has
crsctl check has
一、改变VIP
1、STOP SERVICE
srvctl stop service -d grid -s sales,oltp -n mynode
2、查看VIP设置
[grid@rac1 ~]$ srvctl config vip -n rac1
VIP exists: /rac1vip/172.16.14.56/172.16.14.0/255.255.255.0/eth0, hosting node rac1
3、停止VIP,并且需要关闭LISTENER(因为虚拟IP注册到了LISTENER)
srvctl stop vip -n rac2 -f
4、确定VIP已经关闭
ifconfig -a 发现已经没有相关虚拟IP的地址
5、修改其在HOSTS中的配置
6、
srvctl modify network -S subnet/netmask/interface
7、使用新的VIP roo权限
srvctl modify nodeapps -n node_name -A new_vip_address
srvctl modify nodeapps -n mynode -A 192.168.2.125/255.255.255.0/eth0
8、启动VIP
srvctl start vip -n mynode
9、
在所有节点完成 这个步骤
10、测试联通性
cluvfy comp nodecon -n all -verbose
二、改变私有网络接口
1、olsnodes -s 确定哪些节点是有效的。
[grid@rac2 ~]$ olsnodes -s
rac1 Active
rac2 Active
2、oifcfg getif 查看IP配置信息
3、确定网卡配置信息生效ifconfig
4、配置新的网卡信息修改OCR里面的信息
oifcfg setif -global "eth*/192.168.0.0:cluster_interconnect
5、删除原有的私有网口
oifcfg delif -global eth1/10.10.0.0
6、确定新的私有网口已经生效
oifcfg getif
7、关闭整个crs堆栈
crsctl stop crs
8、down掉已经删除的网络结构
ifconfig down
9、重新启动crs
crsctl start crs
三、在线移动ocr(可以使NFS ASM RAW)
/oracle/app/grid/product/11.2.0/bin/ocrconfig -add +css
/oracle/app/grid/product/11.2.0/bin/ocrconfig -delete +css2
Note: The operations in this section affect OCR clusterwide: they
change the OCR configuration information in the ocr.loc file on
Linux and UNIX systems and the Registry keys on Windows systems.
However, the ocrconfig command cannot modify OCR
configuration information for nodes that are shut down or for nodes
on which Oracle Clusterware is not running.
四、移动votedisk(离线,当votedisk 在ASM上的时候)
/oracle/app/grid/product/11.2.0/bin/crsctl stop cluster -all
各个节点执行
/oracle/app/grid/product/11.2.0/bin/crsctl stop crs -f
在一个节点执行
/oracle/app/grid/product/11.2.0/bin/crsctl start crs -excl -nocrs
然后在此节点执行
[root@rac2 ~]# /oracle/app/grid/product/11.2.0/bin/crsctl replace votedisk +css
Successful addition of voting disk 17ade0f84fed4f89bfbee52bb621586c.
Successful deletion of voting disk 358983bb663b4f6cbf54882b372f30ff.
Successfully replaced voting disk group with +css.
CRS-4266: Voting file(s) successfully replaced
最后关闭
/oracle/app/grid/product/11.2.0/bin/crsctl stop crs -f
(也可以从ASM移动到裸设备
[root@rac2 ~]# /oracle/app/grid/product/11.2.0/bin/crsctl replace votedisk /dev/raw/raw1
Now formatting voting disk: /dev/raw/raw1.
CRS-4256: Updating the profile
Successful addition of voting disk 1114f903fd5b4f4abfe732fdde5df413.
Successful deletion of voting disk 17ade0f84fed4f89bfbee52bb621586c.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
)
重新启动即可
五、在线移动votedisk,当VOTEDISK在NFS或者RAW上的时候
[root@rac2 ~]# /oracle/app/grid/product/11.2.0/bin/crsctl add css votedisk /dev/raw/raw5
Now formatting voting disk: /dev/raw/raw5.
CRS-4603: Successful addition of voting disk /dev/raw/raw5.
[root@rac2 ~]# /oracle/app/grid/product/11.2.0/bin/crsctl delete css votedisk /dev/raw/raw1
CRS-4611: Successful deletion of voting disk /dev/raw/raw1.
六、lcr在哪里
Grid_home/cdata/host_name.olr
由oahs使用这些信息
/oracle/app/grid/product/11.2.0/bin/ocrcheck -local 查看位置
ocrconfig -local -showbackup 查看lcr备份
七、备份和恢复OCR
ocrconfig -showbackup 查看自动备份位置
ocrconfig -manualbackup 查看手动备份记录
ocrconfig -manualbackup auto/manual 也可以查看手动和自动备份
/oracle/app/grid/product/11.2.0/bin/ocrdump -backupfile /oracle/app/grid/product/11.2.0/cdata/rac-cluster/backup00.ocr
能把备份的OCR文件DUMP出来。查看其中的信息。
默认的备份位置就在cdata/cluster_name下面 ocrconfig -backuploc 可以修改备份的位置,没什么必要
1、查看节点
[grid@rac1 ~]$ olsnodes
rac1
rac2
2、关闭CRS及OAHS堆载
/oracle/app/grid/product/11.2.0/bin/crsctl stop cluster -all
然后分别在各个节点关闭
crsctl stop crs -f
(如果是使用的NFS 或者RAW 或者集群文件系统
此时ocrconfig -restore 即可)
一个启动到独占并且不是集群状态下
crsctl start crs -excl -nocrs
检查一下CRSD是否启动如果启动使用
crsctl stop resource ora.crsd -init 关闭
通过 select GROUP_NUMBER ,PATH from v$asm_disk; 来判断ASM磁盘
然后通过
[grid@rac1 ~]$ /etc/init.d/oracleasm querydisk -d DATA6
Disk "DATA6" is a valid ASM disk on device /dev/sdc1[8,33]
来确定使用的那个LV或者LUN,或者NFS盘
在ASM中删除CRSD的磁盘组
drop diskgroup CSS force including contents; (注意使用SYSASM权限)
创建ASM DISKGROUP
create diskgroup CSS external redundancy disk 'ORCL:DATA6' attribute 'COMPATIBLE.ASM' = '11.2';
SQL> create diskgroup CSS external redundancy disk 'ORCL:DATA6' attribute 'COMPATIBLE.ASM' = '11.2';
Diskgroup created.
最后
/oracle/app/grid/product/11.2.0/bin/ocrconfig -restore /oracle/app/grid/product/11.2.0/cdata/rac-cluster/backup00.ocr
ocrcheck
------------
同时可以使用
ocrconfig -export file_name
ocrconfig -import file_name
进行备份恢复,但是又这样一句话
Backups are created when the system is online. You must shut down Oracle
Clusterware on all nodes in the cluster to get a consistent snapshot using the
ocrconfig -export command.
-----------------
/oracle/app/grid/product/11.2.0/bin/ocrdump -backupfile backup00.ocr 可以生成一个名字为OCRDUMPFILE的文件方便查看OCR信息
八、恢复VOTE disk
11gR2中不需要对VOTE disk进行单独的备份,任何DD备份也是无效的。
crsctl start crs -excl 启动到独占模式(可能同时需要先恢复OCR,在OCR损坏的情况下)
crsctl replace votedisk +asm_disk_group(用于ASM下的VOTE)
$ crsctl delete css votedisk FUID
$ crsctl add css votedisk path_to_voting_disk(用于非ASM下的VOTE)
我这里是使用的RAW下的所以
[root@rac1 oracle]# /oracle/app/grid/product/11.2.0/bin/crsctl add css votedisk /dev/raw/raw1
Now formatting voting disk: /dev/raw/raw1.
clsscfgVFFormatted: corrupt volume info block(3)
CRS-4603: Successful addition of voting disk /dev/raw/raw1.
就可以了,重启即可
九、手动备份OCR/LCR,及恢复lcr
ocrconfig [-local] -manualbackup
恢复:
# crsctl stop crs
# ocrconfig -local -restore file_name
# ocrcheck -local
# crsctl start crs
$ cluvfy comp olr
十、实例修改PUBLIC IP 和VIP
注意最好先备份OCR和VOTEDISK
公有IP rac3 172.16.14.63
私有IP rac3prv 10.10.10.5
虚拟IP rac3vip 172.16.14.64
scan ip racscan 172.16.14.58
修改为
公有IP rac3 172.16.1.95
私有IP rac3prv 10.10.10.5
虚拟IP rac3vip 172.16.1.96
scan ip racscan 172.16.14.58
How to Modify Public Network Information including VIP in Oracle Clusterware [ID 276434.1]
1、在CRS 启动阶段执行
/oracle/app/grid/product/11.2.0/bin/oifcfg delif -global eth0/172.16.14.0
/oracle/app/grid/product/11.2.0/bin/oifcfg setif -global eth0/172.16.1.0
[root@rac3 ~]# /oracle/app/grid/product/11.2.0/bin/oifcfg getif
eth1 10.0.0.0 global cluster_interconnect
eth0 172.16.1.0 global public
2、修改OS ip
3、修改HOSTS 文件
172.16.14.29 rac1
172.16.14.55 rac2
172.16.1.95 rac3 ---修改
10.10.10.1 rac1prv
10.10.10.2 rac2prv
10.10.10.5 rac3prv
172.16.14.56 rac1vip
172.16.14.57 rac2vip
172.16.1.96 rac3vip ---修改
172.16.14.58 racscan
4、重启CLUSTER
启动过后发现RAC3 VIP已经漂移到了RAC2
5、查看VIP 信息
[root@rac3 etc]# /oracle/app/grid/product/11.2.0/bin/srvctl config nodeapps -a
Network exists: 1/172.16.14.0/255.255.255.0/eth0, type static
VIP exists: /rac1vip/172.16.14.56/172.16.14.0/255.255.255.0/eth0, hosting node rac1
VIP exists: /rac2vip/172.16.14.57/172.16.14.0/255.255.255.0/eth0, hosting node rac2
VIP exists: /rac3vip/172.16.1.96/172.16.14.0/255.255.255.0/eth0, hosting node rac3
并且资源状态如下:
[root@rac3 etc]# /oracle/app/grid/product/11.2.0/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.CSS.dg ora....up.type ONLINE OFFLINE
ora.CSS2.dg ora....up.type ONLINE ONLINE rac1
ora.DATA1.dg ora....up.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
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....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE OFFLINE
ora.rac3.gsd application OFFLINE OFFLINE
ora.rac3.ons application ONLINE OFFLINE
ora.rac3.vip ora....t1.type ONLINE ONLINE rac2 ---漂移
ora....rac.svc ora....ce.type ONLINE ONLINE rac1
ora.racdb.db ora....se.type ONLINE ONLINE rac1
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
6、关闭INSTANCE 和VIP(10g需要关闭ASM,11G因为OCR一般在ASM下面所以不能关闭ASM)
[root@rac3 etc]# /oracle/app/grid/product/11.2.0/bin/srvctl stop instance -d RACDB -n rac3
[root@rac3 etc]# /oracle/app/grid/product/11.2.0/bin/srvctl stop vip -n rac3 -f
PRCC-1017 : rac3vip was already stopped on rac3
PRCR-1005 : Resource ora.rac3.vip is already stopped
[root@rac3 etc]# /oracle/app/grid/product/11.2.0/bin/srvctl stop vip -i rac3 -f
发生漂移需要指定名字才能关闭
[grid@rac2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.CSS.dg ora....up.type ONLINE OFFLINE
ora.CSS2.dg ora....up.type ONLINE ONLINE rac1
ora.DATA1.dg ora....up.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
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....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE OFFLINE
ora.rac3.gsd application OFFLINE OFFLINE
ora.rac3.ons application ONLINE OFFLINE
ora.rac3.vip ora....t1.type OFFLINE OFFLINE ---已经关闭
ora....rac.svc ora....ce.type ONLINE ONLINE rac1
ora.racdb.db ora....se.type ONLINE ONLINE rac1
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
7、
修改VIP 资源
[root@rac3 etc]# /oracle/app/grid/product/11.2.0/bin/srvctl modify nodeapps -n rac3 -A rac3vip/255.255.255.0/eth0
8、启动VIP资源和实例
srvctl start vip -n rac3
srvctl start instance -d racdb -n rac3
9、验证
查看crs_stat 看到VIP 资源已经在RAC3启动
[grid@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.CSS.dg ora....up.type ONLINE OFFLINE
ora.CSS2.dg ora....up.type ONLINE ONLINE rac1
ora.DATA1.dg ora....up.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
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....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application OFFLINE OFFLINE
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip ora....t1.type ONLINE ONLINE rac3 ----已经在RAC3启动
ora....rac.svc ora....ce.type ONLINE ONLINE rac1
ora.racdb.db ora....se.type ONLINE ONLINE rac1
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
查看IP地址
eth0:1 Link encap:Ethernet HWaddr 00:50:56:B0:00:1C
inet addr:172.16.1.96 Bcast:172.16.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0x2800 Memory:d8920000-d8940000
但是进一步发现VIP启动出现错误,而且VIP是PING不通的。
ping 172.16.1.96 是不通的。
CRS-5017: The resource action "ora.rac1.vip start" encountered the following error:
CRS-5009: The VIP address 172.16.14.56 does not belong to the subnet 172.16.1.0
文档如下:
RAC and Oracle Clusterware Best Practices and Starter Kit (Platform. Independent) [ID 810394.1]
表明VIP必须在同一网段。
然后测试PUB是否可以和VIP在不同网段
关闭CRS
修改HOSTS
启动CRS--启动NODEAPPS不能启动
修改NODEAPPS
最后启动VIP发现虽然可以启动但是启动后VIP漂移到RAC2
[grid@rac3 crsd]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.CSS.dg ora....up.type ONLINE OFFLINE
ora.CSS2.dg ora....up.type ONLINE ONLINE rac1
ora.DATA1.dg ora....up.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
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....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE OFFLINE
ora.rac3.gsd application OFFLINE OFFLINE
ora.rac3.ons application ONLINE OFFLINE
ora.rac3.vip ora....t1.type ONLINE ONLINE rac2 ---漂移
ora....rac.svc ora....ce.type ONLINE ONLINE rac1
ora.racdb.db ora....se.type ONLINE ONLINE rac1
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
启动LISTENER
[grid@rac3 crsd]$ /oracle/app/grid/product/11.2.0/bin/srvctl start listener -n rac3
PRCR-1013 : Failed to start resource ora.LISTENER.lsnr
PRCR-1064 : Failed to start resource ora.LISTENER.lsnr on node rac3
CRS-2674: Start of 'ora.net1.network' on 'rac3' failed
不能启动