5.换存储迁移数据(在线迁移ASM磁盘组)测试,更换DATA\ARCH盘 -->可以停实例,也可以在线做(保险停实例)
5.1登录到ASM实例,查看当前磁盘组的信息
select group_number,name,type,total_mb,free_mb from v$asm_diskgroup;
select NAME,PATH,total_mb,free_mb from v$asm_disk;
过程如下:
SQL> select group_number,name,type,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME TYPE TOTAL_MB FREE_MB
------------ ------------------------------ ------ ---------- ----------
2 ARCH EXTERN 10240 9868
4 DATA EXTERN 51200 49197
5 OCR_NEW NORMAL 9216 8290
SQL> set line 9999
SQL> select NAME,PATH,total_mb,free_mb from v$asm_disk;
NAME PATH TOTAL_MB FREE_MB
------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- ----------
/dev/mapper/OCR 0 0
/dev/mapper/DATA_NEW 0 0
/dev/mapper/ARCH_NEW 0 0
OCR_NEW_FG1_VOL1 /dev/mapper/OCR_NEW1 3072 2763
OCR_NEW_FG2_VOL2 /dev/mapper/OCR_NEW2 3072 2764
OCR_NEW_FG3_VOL3 /dev/mapper/OCR_NEW3 3072 2763
DATA_0000 /dev/mapper/DATA 51200 49197
ARCH_0000 /dev/mapper/ARCH 10240 9868
说明:/dev/mapper/OCR,是被更换的ASM磁盘,/dev/mapper/DATA_NEW 、/dev/mapper/ARCH_NEW 是要更换的新存储
5.2.迁移数据磁盘组数据
5.2.1 扩盘
alter diskgroup DATA add disk '/dev/mapper/DATA_NEW' rebalance power 11; //添加磁盘data磁盘 -->测试环境开为了效率开power11,生产环境根据性能开4~7就行
alter diskgroup ARCH add disk '/dev/mapper/ARCH_NEW' rebalance power 11;//添加磁盘日志磁盘
select * from v$asm_operation;//查看rebalance的情况
由于指定rebalance power 11,ASM会自动均衡ASM磁盘组DATA里面存放的数据在各ASM磁盘的分布。
当rebalance结束后,查询V$ASM_OPERATION视图,将不会返回信息。
注意一定要查询未空时才能进行删除操作
此时查询磁盘组信息
select group_number,name,type,total_mb,free_mb from v$asm_diskgroup;
观察DATA和FRA_ARC的磁盘大小
select name,path,state from v$asm_disk;
5.2.2 剔除需要下架的磁盘
alter diskgroup DATA drop disk 'DATA_0000' rebalance power 11;
alter diskgroup ARCH drop disk 'ARCH_0000' rebalance power 11;
select * from v$asm_operation;
ASM不但向磁盘组中加入新磁盘时会做rebalance,在删除ASM磁盘时也会rebalance,将该磁盘上的数据rebalance到其他该磁盘组的磁盘中。
按照此方法删除ASM磁盘后,ASM的所有数据都已经存放在新的存储上
此时查询磁盘组信息
select group_number,name,type,total_mb,free_mb from v$asm_diskgroup;
观察DATA和FRA_ARC的磁盘大小
select name,path,state from v$asm_disk;
5.3查看crs是否正常
crsctl stat res -t