【解析】
● Disks
磁盘组创建时使用CREATE DISKGROUP 语句, 创建时允许我们设置冗余项:
NORMAL REDUNDANCY - Two-way mirroring, requiring two failure groups.
HIGH REDUNDANCY - Three-way mirroring, requiring three failure groups.
EXTERNAL REDUNDANCY - No mirroring for disks that are already protected using hardware mirroring or RAID.
If you have hardware RAID it should be used in preference to ASM redundancy, so this will be the standard option for most installations.
● Fast Mirror Resync
在短暂的磁盘故障发生时, ASM 保持跟踪记录那些要被写入掉线的磁盘中所改变的部分;
一旦磁盘再次可以使用时,那些改变的部分变被再次的同步到磁盘中, 而不是被覆写全盘的内容;这种机制可以适当的加快重新同步数据的效率;
快速镜像同步(fast mirror resync) 这种机制仅仅在磁盘组的 compatibility attributes 被设置为 11.1 or higher才生效
● How ASM Manages Disk Failures
取决于磁盘组的冗余级别和定义的故障组,一个或多个的故障磁盘可能导致以下结果之一:
1.磁盘首先take offline(下线)随后被自动drop(剔除);在这种情况下磁盘组一直挂载着并且提供着服务;
另外由于镜像的存在,所有的磁盘组的信息保持健康的状态;
随后在磁盘移除的操作之后,ASM执行一个再平衡调整用于重建全部的冗余项来恢复那些在坏掉的磁盘的上的数据
2.全部的磁盘组自动的卸载,这意味着丢失掉的数据的可访问性
【实验】
检索v$asm_attribute视图可以得到disk_repair_time在内的属性信息
NAME VALUE GROUP_NUMBER ATTRIBUTE_INDEX ATTRIBUTE_INCARNATION READ_ON SYSTEM_
---------------------------------------- ---------- ------------ --------------- --------------------- ------- -------
disk_repair_time 3.6h 1 0 1 N Y
au_size 1048576 1 5 1 Y Y
sector_size 512 1 6 1 Y Y
compatible.asm 11.2.0.0.0 1 20 1 N Y
compatible.rdbms 10.1.0.0.0 1 21 1 N Y
cell.smart_scan_capable FALSE 1 30 1 N N
access_control.enabled FALSE 1 40 1 N Y
access_control.umask 066 1 41 1 N Y
template_version 186646528 1 50 1 N Y
template.PARAMETERFILE.stripe 0 1 71 1 N Y
template.PARAMETERFILE.redundancy 18 1 74 1 N Y
template.PARAMETERFILE.primary_region 0 1 75 1 N Y
template.PARAMETERFILE.mirror_region 0 1 76 1 N Y
template.ASMPARAMETERFILE.stripe 0 1 81 1 N Y
template.ASMPARAMETERFILE.redundancy 18 1 84 1 N Y
template.ASMPARAMETERFILE.primary_region 0 1 85 1 N Y
template.ASMPARAMETERFILE.mirror_region 0 1 86 1 N Y
template.DUMPSET.stripe 0 1 101 1 N Y
template.DUMPSET.redundancy 18 1 104 1 N Y
template.DUMPSET.primary_region 0 1 105 1 N Y
template.DUMPSET.mirror_region 0 1 106 1 N Y
template.CONTROLFILE.stripe 1 1 111 1 N Y
template.CONTROLFILE.redundancy 19 1 114 1 N Y
template.CONTROLFILE.primary_region 0 1 115 1 N Y
template.CONTROLFILE.mirror_region 0 1 116 1 N Y
template.FLASHFILE.stripe 0 1 121 1 N Y
template.FLASHFILE.redundancy 18 1 124 1 N Y
template.FLASHFILE.primary_region 0 1 125 1 N Y
template.FLASHFILE.mirror_region 0 1 126 1 N Y
template.ARCHIVELOG.stripe 0 1 131 1 N Y
template.ARCHIVELOG.redundancy 18 1 134 1 N Y
template.ARCHIVELOG.primary_region 0 1 135 1 N Y
template.ARCHIVELOG.mirror_region 0 1 136 1 N Y
template.ONLINELOG.stripe 0 1 141 1 N Y
template.ONLINELOG.redundancy 18 1 144 1 N Y
template.ONLINELOG.primary_region 0 1 145 1 N Y
template.ONLINELOG.mirror_region 0 1 146 1 N Y
template.DATAFILE.stripe 0 1 151 1 N Y
template.DATAFILE.redundancy 18 1 154 1 N Y
template.DATAFILE.primary_region 0 1 155 1 N Y
template.DATAFILE.mirror_region 0 1 156 1 N Y
template.TEMPFILE.stripe 0 1 161 1 N Y
template.TEMPFILE.redundancy 18 1 164 1 N Y
template.TEMPFILE.primary_region 0 1 165 1 N Y
template.TEMPFILE.mirror_region 0 1 166 1 N Y
template.BACKUPSET.stripe 0 1 181 1 N Y
template.BACKUPSET.redundancy 18 1 184 1 N Y
template.BACKUPSET.primary_region 0 1 185 1 N Y
template.BACKUPSET.mirror_region 0 1 186 1 N Y
template.AUTOBACKUP.stripe 0 1 191 1 N Y
template.AUTOBACKUP.redundancy 18 1 194 1 N Y
template.AUTOBACKUP.primary_region 0 1 195 1 N Y
template.AUTOBACKUP.mirror_region 0 1 196 1 N Y
template.XTRANSPORT.stripe 0 1 201 1 N Y
template.XTRANSPORT.redundancy 18 1 204 1 N Y
template.XTRANSPORT.primary_region 0 1 205 1 N Y
template.XTRANSPORT.mirror_region 0 1 206 1 N Y
template.CHANGETRACKING.stripe 0 1 211 1 N Y
template.CHANGETRACKING.redundancy 18 1 214 1 N Y
template.CHANGETRACKING.primary_region 0 1 215 1 N Y
template.CHANGETRACKING.mirror_region 0 1 216 1 N Y
template.FLASHBACK.stripe 0 1 221 1 N Y
template.FLASHBACK.redundancy 18 1 224 1 N Y
template.FLASHBACK.primary_region 0 1 225 1 N Y
template.FLASHBACK.mirror_region 0 1 226 1 N Y
template.DATAGUARDCONFIG.stripe 0 1 231 1 N Y
template.DATAGUARDCONFIG.redundancy 18 1 234 1 N Y
template.DATAGUARDCONFIG.primary_region 0 1 235 1 N Y
template.DATAGUARDCONFIG.mirror_region 0 1 236 1 N Y
template.OCRFILE.stripe 0 1 241 1 N Y
template.OCRFILE.redundancy 18 1 244 1 N Y
template.OCRFILE.primary_region 0 1 245 1 N Y
template.OCRFILE.mirror_region 0 1 246 1 N Y
73 ROWS selected.
查看磁盘信息
GROUP_NUMBER DISK_NUMBER NAME STATE REPAIR_TIMER
------------ ----------- ---------------------------------------- -------- ------------
1 1 DATA_0001 NORMAL 0
1 0 DATA_0000 NORMAL 0
将磁盘离线,提示兼容性设置的不够
ALTER diskgroup data OFFLINE disk data_0001
*
ERROR AT line 1:
ORA-15032: NOT ALL alterations performed
ORA-15283: ASM operation requires compatible.rdbms OF 11.1.0.0.0 OR higher
修改兼容性属性
Diskgroup altered.
SQL> SELECT * FROM v$asm_attribute WHERE name LIKE 'compatible%';
NAME VALUE GROUP_NUMBER ATTRIBUTE_INDEX ATTRIBUTE_INCARNATION READ_ON SYSTEM_
---------------------------------------- ---------- ------------ --------------- --------------------- ------- -------
compatible.asm 11.2.0.0.0 1 20 1 N Y
compatible.rdbms 11.2.0.0.0 1 21 1 N Y
再将磁盘离线
Diskgroup altered.
查看磁盘状态,可以看到磁盘状态的变化
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST NAME PATH REPAIR_TIMER
------------ ----------- ------- ------------ ------- -------------------- -------------------- ------------
0 1 CLOSED MEMBER ONLINE /dev/RAW/raw2 0
1 1 MISSING UNKNOWN OFFLINE DATA_0001 12777
1 0 CACHED MEMBER ONLINE DATA_0000 /dev/RAW/raw1 0
使磁盘上线,再次查看状态
Diskgroup altered.
SQL> SELECT GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,NAME,PATH,REPAIR_TIMER FROM v$asm_disk;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST NAME PATH REPAIR_TIMER
------------ ----------- ------- ------------ ------- -------------------- -------------------- ------------
1 0 CACHED MEMBER ONLINE DATA_0000 /dev/RAW/raw1 0
1 1 CACHED MEMBER SYNCING DATA_0001 /dev/RAW/raw2 12777
同时可以看到磁盘正在进行online操作
GROUP_NUMBER OPERA STAT
------------ ----- ----
1 ONLIN RUN
SQL> SELECT GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,NAME,PATH,REPAIR_TIMER FROM v$asm_disk;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST NAME PATH REPAIR_TIMER
------------ ----------- ------- ------------ ------- -------------------- -------------------- ------------
1 0 CACHED MEMBER ONLINE DATA_0000 /dev/RAW/raw1 0
1 1 CACHED MEMBER ONLINE DATA_0001 /dev/RAW/raw2 0
如果要立即删除磁盘而不用等待disk_repair_time时间,使用如下语句
Diskgroup altered.
查看磁盘状态
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST NAME PATH REPAIR_TIMER
------------ ----------- ------- ------------ ------- -------------------- -------------------- ------------
0 1 CLOSED MEMBER ONLINE /dev/RAW/raw2 0
1 1 MISSING UNKNOWN OFFLINE DATA_0001 0
1 0 CACHED MEMBER ONLINE DATA_0000 /dev/RAW/raw1 0
此时再执行online操作无法成功
ALTER DISKGROUP data ONLINE DISK DATA_0001
*
ERROR AT line 1:
ORA-15032: NOT ALL alterations performed
ORA-15054: disk "DATA_0001" does NOT exist IN diskgroup "DATA"
如果要重新添加的话,直接添加会失败,需要使用dd命令清除文件头,或者使用force参数
ALTER diskgroup DATA ADD disk '/dev/raw/raw2'
*
ERROR AT line 1:
ORA-15032: NOT ALL alterations performed
ORA-15033: disk '/dev/raw/raw2' belongs TO diskgroup "DATA"
SQL> ALTER diskgroup DATA ADD disk '/dev/raw/raw2' force;
Diskgroup altered.
SQL> SELECT GROUP_NUMBER, OPERATION, STATE FROM V$ASM_OPERATION;
GROUP_NUMBER OPERA STAT
------------ ----- ----
1 REBAL RUN
SQL> SELECT GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,NAME,PATH,REPAIR_TIMER FROM v$asm_disk;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST NAME PATH REPAIR_TIMER
------------ ----------- ------- ------------ ------- -------------------- -------------------- ------------
1 1 MISSING UNKNOWN OFFLINE _DROPPED_0001_DATA 0
1 0 CACHED MEMBER ONLINE DATA_0000 /dev/RAW/raw1 0
1 2 CACHED MEMBER ONLINE DATA_0002 /dev/RAW/raw2 0
SQL> SELECT GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,NAME,PATH,REPAIR_TIMER FROM v$asm_disk;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU MODE_ST NAME PATH REPAIR_TIMER
------------ ----------- ------- ------------ ------- -------------------- -------------------- ------------
1 0 CACHED MEMBER ONLINE DATA_0000 /dev/RAW/raw1 0
1 2 CACHED MEMBER ONLINE DATA_0002 /dev/RAW/raw2 0
【小结】
A 磁盘会被立即drop掉,这个答案明显不对。
B 在短暂故障发生时,ASM的处理方法便是这种,所以B正确。
C ASM不会迁移盘区到剩余可用的盘区。
D 当磁盘由于断电等原因导致失败时,asm会自动下线该磁盘,所以D正确。
【答案】 B,D
Speak Your Mind