1, ASM磁盘的类型
选择1:裸设备/dev/raw/,需要raw服务支持.
选择2:ASMLib管理,需要安装Linux下ASMLib的rpm包,创建ASM可以识别的VOL.
2, ASM磁盘的管理
删除磁盘组中的磁盘成员alter diskgroup dgroup1 drop disk VOL2;
删除磁盘组drop diskgroup DISKGROUP1 including contents;只有当磁盘组中磁盘被删除后,磁盘组才能从ASM删除.
创建磁盘组create diskgroup DISKGROUP2 EXTERNAL REDUNDANCY DISK '/dev/raw/raw3','/dev/raw/raw4';以外部冗余为例.
添加磁盘alter diskgroup DISKGROUP2 add disk '/dev/raw/raw5';
3, 查询ASM磁盘组与磁盘成员
v$asm_disk;
v$asm_diskgroup;
SQL> select g.name,g.state,g.type,d.name from v$asm_diskgroup g,v$asm_disk d where g.group_number=d.group_number;
NAME STATE TYPE NAME
------------------------------ ----------- ------ ------------------------------
DATA MOUNTED EXTERN DATA1
RECOVERY MOUNTED EXTERN DATA2
4, 查询ASM与数据库实例相关的参数
SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ FROM SYS.x$ksppi x, SYS.x$ksppcv y WHERE x.indx = y.indx AND x.ksppinm LIKE '%&par%'
NAME VALUE DESCRIB
------------------------------ ----------------- ----------------------------------------------------
asm_diskstring disk set locations for discovery
_asm_disk_repair_time 14400 seconds to wait before dropping a failing disk
asm_diskgroups disk groups to mount automatically
asm_power_limit 1 number of processes for disk rebalancing
_asm_ausize 1048576 allocation unit size
_asm_blksize 4096 metadata block size
_asm_acd_chunks 1 initial ACD chunks created
_asm_libraries ufs library search order for discovery
_asm_maxio 1048576 Maximum size of individual I/O request
_asm_allow_only_raw_disks TRUE Discovery only raw devices
_asmlib_test 0 Osmlib test event
NAME VALUE DESCRIB
------------------------------ ------------------- -----------------------------------------------
_asm_allow_resilver_corruption FALSE Enable disk resilvering for external redundancy
_asmsid asm ASM instance id
_asm_wait_time 18 Max/imum time to wait before asmb exits
_asm_stripewidth 8 ASM file stripe width
_asm_stripesize 131072 ASM file stripe size
_asm_droptimeout 60 timeout before offlined disks get dropped (in 3s ticks)
_asm_emulmax 10000 max number of concurrent disks to emulate I/O errors
_asm_emultimeout 0 timeout before emulation begins (in 3s ticks)
_asm_kfdpevent 0 KFDP event
5, 例子给RAC现有的ASM磁盘组添加磁盘
在节点1上创建ASM卷
[root@vmrac1 raw]# /etc/init.d/oracleasm createdisk DATA3 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk: [ OK ]
[root@vmrac1 raw]# /etc/init.d/oracleasm listdisks
DATA1
DATA2
DATA3
[root@vmrac1 raw]# /etc/init.d/oracleasm createdisk DATA4 /dev/sdf1
Marking disk "/dev/sdf1" as an ASM disk: [ OK ]
[root@vmrac1 raw]# /etc/init.d/oracleasm listdisks
DATA1
DATA2
DATA3
DATA4
注意:一定要在第二个节点扫描磁盘,以保证磁盘被2节点识别.
[root@vmrac2 raw]# /etc/init.d/oracleasm scandisk
在vmrac1上添加磁盘到指定磁盘组
alter diskgroup DATA add disk 'ORCL:DATA3';
alter diskgroup RECOVERY add disk 'ORCL:DATA4';
分别在2个节点上验证
SQL> select g.name,d.state,g.state,g.type,d.name from v$asm_diskgroup g,v$asm_disk d where g.group_number=d.group_number;
NAME STATE STATE TYPE NAME
------------------------------ -------- ----------- ------ ------------------------------
DATA NORMAL MOUNTED EXTERN DATA1
DATA FORCING MOUNTED EXTERN DATA3
RECOVERY NORMAL MOUNTED EXTERN DATA2
RECOVERY NORMAL MOUNTED EXTERN DATA4
正常的步骤到这里应该是添加成功,但由于我的操作有误,第二个节点没有扫描磁盘,就去添加了DATA3,导致下面的问题.
这里由于第二个节点没有扫描磁盘,导致DATA3没有办法添加上去,便强行添加DATA3,最后出错,如上显示STATE为FORCING状态.
最后我直接删除会报错,然后取消添加,再按正常的方式添加一遍,成功了!
SQL> alter diskgroup DATA drop disk DATA3;
alter diskgroup DATA drop disk DATA3
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15071: ASM disk "DATA3" is already being dropped
SQL> alter diskgroup DATA undrop disks;
Diskgroup altered.
SQL> select g.name,d.state,g.state,g.type,d.name from v$asm_diskgroup g,v$asm_disk d where g.group_number=d.group_number;
NAME STATE STATE TYPE NAME
------------------------------ -------- ----------- ------ ------------------------------
DATA NORMAL MOUNTED EXTERN DATA1
RECOVERY NORMAL MOUNTED EXTERN DATA2
RECOVERY NORMAL MOUNTED EXTERN DATA4
SQL> alter diskgroup DATA add disk 'ORCL:DATA3';
Diskgroup altered.
DATA3已经恢复为正常状态
SQL> select g.name,d.state,g.state,g.type,d.name from v$asm_diskgroup g,v$asm_disk d where g.group_number=d.group_number;
NAME STATE STATE TYPE NAME
------------------------------ -------- ----------- ------ ------------------------------
DATA NORMAL MOUNTED EXTERN DATA1
DATA NORMAL MOUNTED EXTERN DATA3
RECOVERY NORMAL MOUNTED EXTERN DATA2
RECOVERY NORMAL MOUNTED EXTERN DATA4
alter日志
Sat Aug 25 19:19:49 2012
SQL> alter diskgroup DATA drop disk DATA3
Sat Aug 25 19:40:02 2012
SQL> alter diskgroup DATA undrop disks
Sat Aug 25 19:40:02 2012
NOTE: PST update: grp = 1
NOTE: requesting all-instance PST refresh for group=1
Sat Aug 25 19:40:02 2012
NOTE: PST refresh pending for group 1/0x843861e5 (DATA)
SUCCESS: refreshed PST for 1/0x843861e5 (DATA)
Sat Aug 25 19:40:05 2012
NOTE: starting rebalance of group 1/0x843861e5 (DATA) at power 1
Starting background process ARB0
ARB0 started with pid=24, OS id=9157
Sat Aug 25 19:40:06 2012
NOTE: assigning ARB0 to group 1/0x843861e5 (DATA)
NOTE: stopping process ARB0
Sat Aug 25 19:40:09 2012
SUCCESS: rebalance completed for group 1/0x843861e5 (DATA)
Sat Aug 25 19:40:09 2012
SUCCESS: rebalance completed for group 1/0x843861e5 (DATA)
Sat Aug 25 19:40:15 2012
NOTE: PST update: grp = 1
SUCCESS: grp 1 disk DATA3 emptied
WARNING: offlining disk 1.3915944215 (DATA3) with mask 0x1
NOTE: PST update: grp = 1, dsk = 1, mode = 0x6
NOTE: cache closing disk 1 of grp 1: DATA3
NOTE: PST update: grp = 1
NOTE: erasing header on grp 1 disk DATA3
SQL> alter diskgroup DATA add disk 'ORCL:DATA3'
Sat Aug 25 19:50:45 2012
NOTE: reconfiguration of group 1/0x843861e5 (DATA), full=1
Sat Aug 25 19:50:45 2012
NOTE: initializing header on grp 1 disk DATA3
NOTE: cache opening disk 1 of grp 1: DATA3 label:DATA3
Sat Aug 25 19:50:45 2012
NOTE: PST update: grp = 1
NOTE: requesting all-instance disk validation for group=1
Sat Aug 25 19:50:45 2012
NOTE: disk validation pending for group 1/0x843861e5 (DATA)
SUCCESS: validated disks for 1/0x843861e5 (DATA)
Sat Aug 25 19:50:48 2012
NOTE: PST update: grp = 1
NOTE: requesting all-instance PST refresh for group=1
Sat Aug 25 19:50:48 2012
NOTE: PST refresh pending for group 1/0x843861e5 (DATA)
SUCCESS: refreshed PST for 1/0x843861e5 (DATA)
Sat Aug 25 19:50:51 2012
NOTE: requesting all-instance PST refresh for group=1
Sat Aug 25 19:50:51 2012
NOTE: PST refresh pending for group 1/0x843861e5 (DATA)
SUCCESS: refreshed PST for 1/0x843861e5 (DATA)
Sat Aug 25 19:50:55 2012
NOTE: starting rebalance of group 1/0x843861e5 (DATA) at power 1
Starting background process ARB0
ARB0 started with pid=24, OS id=26806
Sat Aug 25 19:50:55 2012
NOTE: assigning ARB0 to group 1/0x843861e5 (DATA)
Sat Aug 25 19:50:57 2012
NOTE: X->S down convert bast on F1B3 bastCount=2
NOTE: X->S down convert bast on F1B3 bastCount=3
NOTE: X->S down convert bast on F1B3 bastCount=4
NOTE: X->S down convert bast on F1B3 bastCount=5
NOTE: X->S down convert bast on F1B3 bastCount=6
NOTE: X->S down convert bast on F1B3 bastCount=7
NOTE: X->S down convert bast on F1B3 bastCount=8
NOTE: X->S down convert bast on F1B3 bastCount=9
NOTE: X->S down convert bast on F1B3 bastCount=10
NOTE: X->S down convert bast on F1B3 bastCount=11
NOTE: X->S down convert bast on F1B3 bastCount=12
NOTE: X->S down convert bast on F1B3 bastCount=13
NOTE: X->S down convert bast on F1B3 bastCount=14
NOTE: X->S down convert bast on F1B3 bastCount=15
NOTE: X->S down convert bast on F1B3 bastCount=16
NOTE: X->S down convert bast on F1B3 bastCount=17
NOTE: X->S down convert bast on F1B3 bastCount=18
NOTE: X->S down convert bast on F1B3 bastCount=19
NOTE: X->S down convert bast on F1B3 bastCount=20
NOTE: X->S down convert bast on F1B3 bastCount=21
NOTE: X->S down convert bast on F1B3 bastCount=22
Sat Aug 25 19:52:30 2012
NOTE: X->S down convert bast on F1B3 bastCount=23
Sat Aug 25 20:01:06 2012
NOTE: stopping process ARB0
Sat Aug 25 20:01:07 2012
SUCCESS: rebalance completed for group 1/0x843861e5 (DATA)
Sat Aug 25 20:01:07 2012
SUCCESS: rebalance completed for group 1/0x843861e5 (DATA)
NOTE: PST update: grp = 1
NOTE: PST update: grp = 1
Sat Aug 25 20:07:30 2012
NOTE: X->S down convert bast on F1B3 bastCount=24