实验环境:
centos6.4
oracle 11.2.0.4
--
使用的是udev方式映射的raw,然后做的是asm
---
本来想把sdb,sdc这个块磁盘替换掉。
sdb => 1g:sdb1,sdb2,sdb3. 2g:sdb5,sdb6,sdb7
sdc => 2g:sdc1,sdc2,sdc3,sdc5,sdc6
做成了2个磁盘组
OCR sdb1,sdb2,sdb3 raw1,raw2,raw3,raw4
DATA sdb5,sdb6,sdb7 sdc1 raw5 ,raw6,raw7,raw8
FRA sdc2,sdc3,sdc5,sdc6 raw9 ,raw10,raw11,raw12
asm磁盘组的磁盘不建议用扩展分区,
--------
想把这2块盘换掉
退出虚拟机,又加了2块磁盘
sdd :1g:sdd1,sdd2,sdd3. 2g:sdd5,sdd6,sdd7
sde :2g:sde1,sde2,sde3,sde5,sde6
然后在/etc/udev/rules.d/60-raw.rules 添加下面内容
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw12 %N"
ACTION=="add", KERNEL=="sdd2", RUN+="/bin/raw /dev/raw/raw13 %N"
ACTION=="add", KERNEL=="sdd3", RUN+="/bin/raw /dev/raw/raw14 %N"
ACTION=="add", KERNEL=="sdd5", RUN+="/bin/raw /dev/raw/raw15 %N"
ACTION=="add", KERNEL=="sdd6", RUN+="/bin/raw /dev/raw/raw16 %N"
ACTION=="add", KERNEL=="sdd7", RUN+="/bin/raw /dev/raw/raw17 %N"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw18 %N"
ACTION=="add", KERNEL=="sde2", RUN+="/bin/raw /dev/raw/raw19 %N"
ACTION=="add", KERNEL=="sde3", RUN+="/bin/raw /dev/raw/raw20 %N"
ACTION=="add", KERNEL=="sde5", RUN+="/bin/raw /dev/raw/raw21 %N"
ACTION=="add", KERNEL=="sde6", RUN+="/bin/raw /dev/raw/raw22 %N"
KERNEL=="raw[1-9]",OWNER="grid",GROUP="asmadmin" MODE="660"
KERNEL=="raw1[0-9]",OWNER="grid",GROUP="asmadmin" MODE="660"
KERNEL=="raw2[0-2]",OWNER="grid",GROUP="asmadmin" MODE="660"
---
然后进如asm实例
su - grid
sqlplus / as sysasm
select name,path from v$asm_disk;
name path
------- ----------
OCR_0000 /dev/raw/raw1
OCR_0001 /dev/raw/raw2
OCR_0002 /dev/raw/raw3
DATA_0000 /dev/raw/raw4
DATA_0001 /dev/raw/raw5
DATA_0002 /dev/raw/raw6
DATA_0003 /dev/raw/raw7
FRA_0000 /dev/raw/raw8
FRA_0001 /dev/raw/raw9
FRA_0002 /dev/raw/raw10
FRA_0003 /dev/raw/raw11
发现到了新添加的磁盘
然后进行替换
-
OCR
alter diskgroup ocr add disk '/dev/raw/raw12','/dev/raw/raw13','/dev/raw/raw14';
alter diskgroup ocr drop disk 'OCR_0000','OCR_0001','OCR_0002';
-
DATA
alter diskgroup data add disk '/dev/raw/raw15','/dev/raw/raw16','/dev/raw/raw17','/dev/raw/raw18';
alter diskgroup data drop disk 'DATA_0000','DATA_0001','DATA_0002','DATA_0003';
--
FRA
alter diskgroup fra add disk '/dev/raw/raw19','/dev/raw/raw20','/dev/raw/raw21','/dev/raw/raw22';
alter diskgroup fra drop disk 'FRA_0000','FRA_0001','FRA_0002','FRA_0003';
--
select group_number,operation,power,state from v$asm_operation;
等这里面没有信息,说明数据全部移动完。
-----
然后关闭虚拟机。
把sdb和sdc这2块对应的盘从虚拟机中删除
还在rac2节点加了一块非共享盘
开机
发现磁盘的对应关系发生了改变。
rac1
sdd 成了sdb
sde 成了sdc
rac2
sdd 成了sdc
sde 成了sdd
盘符全乱了。
自己重新映射了一下。发现还是有问题。
-
然后决定不用盘符映射。用scsi_id方式映射,这样共享盘是不能分区的。
在没做其他操作下,
把2块共享盘的分区全部删除。这样就在共享盘上的ocr,vote disk,data,fra的信息全部丢失。
--
然后在/etc/udev/rules.d/60-raw.rules做如下改动
ACTION=="add", KERNEL=="sd*", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$name",
RESULT=="360022a11000e085d0de717f500000003", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sd*", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$name",
RESULT=="360022a11000e085d0de7372c0000002e", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="adc", KERNEL=="sd*", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$name",
RESULT=="360022a11000e085d0de7372c0000018e", RUN+="/bin/raw /dev/raw/raw2 %N"
KERNEL=="raw[1-3]", OWNER="grid", GROUP="oinstall", MODE="660"
--
RESULT=="360022a11000e085d0de717f500000003"
这个值的获得 root#/sbin/scsi_id -g -u -d /dev/sdd
linux版本不同,命令的路径不同。
---
映射后,最好重启下。
===
这样,系统重启后,发现crs宕掉,也无法启动。
asm实例无法启动,磁盘组也不存在。
===============
先重建crs
2节点都做
root#./crsctl stop crs
pwd
/oracle/app/11.2.0/grid/crs/install
root#./rootcrs.pl -deconfig -force
--
然后
2节点都做
pwd
/oracle/app/11.2.0/grid
./root.sh
重建成功
===============
那就做ocr和vote disk恢复吧。数据库还有一份备份。
pwd
/oracle/app/11.2.0/grid/bin
rac1
root#./crsctl stop has
rac2
root#./crsctl stop has
ocr的备份在rac2上
rac2
root#./crsctl start crs -excl -nocrs 启动到独占模式
grid$sqlplus / as sysasm
进入到asm实例成功
创建磁盘组
create diskgroup OCR external redundancy disk '/dev/raw/raw1'
ATTRIBUTE 'compatible.asm'='11.2.0.0.0';
===============================================
ATTRIBUTE 'compatible.asm'='11.2.0.0.0';
这句比较关键,如果不带,恢复OCR无法成功。
/ocrconfig –restore backup00.ocr
无法完成
PROT-35: The configured OCR locations are not accessible.
==============================================
然后恢复OCR
root#./ocrconfig -restore /oracle/app/11.2.0/grid/cdata/rac-cluster/backup.ocr
成功
恢复vote disk
root#./crsctl replace votedisk +OCR
sqlplus / as sysasm
create spfile from memory;
-------
rac2
root#./crsctl stop has
--
rac1
root#./crsctl start crs
rac2
root#./crsctl start crs
=====
然后
rac1
用+ASM1登录时出错
sqlplus / as sysasm
ps -ef|grep asm
asm2
--
export ORACLE_SID=+ASM2
sqlplus / as sysasm
进入成功
exit
--
vi /etc/oratab
+ASM2 -->+ASM1
--
oraenv
+ASM1
sqlplus / as sysasm
实例进入成功
ps -ef |grep asm
----
然后重新创建DATA和FRA磁盘组
sqlplus / as sysasm
create diskgroup data add disk '/dev/raw/raw2';
create diskgroup fra add disk '/dev/raw/raw3';
===============
转载于:https://blog.51cto.com/10191970/1918354