Saturday, January 22, 2011

Queries Related to ASM

Check if css is running/working

crsctl check cssd

Display disk-groups

set lines 100
col name format a10
col path  format a30
select name
, group_number
, disk_number
, mount_status
, state
, path
from  v$asm_disk
order  by group_number
/
Ouput:
NAME          GROUP_NUMBER     DISK_NUMBER MOUNT_S STATE    PATH
---------- --------------- --------------- ------- -------- ------------------------------
ASMDISK27                1               9 CACHED  NORMAL   ORCL:ASMDISK27
ASMDISK26                1               8 CACHED  NORMAL   ORCL:ASMDISK26
ASMDISK25                1               7 CACHED  NORMAL   ORCL:ASMDISK25
ASMDISK29                1              11 CACHED  NORMAL   ORCL:ASMDISK29


Show disk space usage

select  name
,       group_number
,       disk_number
,       total_mb
,       free_mb
from    v$asm_disk
order   by group_number
/
Output:
NAME          GROUP_NUMBER     DISK_NUMBER        TOTAL_MB         FREE_MB
---------- --------------- --------------- --------------- ---------------
ASMDISK27                1               9          185869          157364
ASMDISK26                1               8          185869          157373
ASMDISK25                1               7          185869          157370
ASMDISK29                1              11          185869          157358


Create a disk group

create diskgroup data1
external redundancy
disk '/dev/raw/raw1'
/


or with multiple raw partitions...
multiple disks
create diskgroup data2
external redundancy
disk '/dev/raw/raw2'
, '/dev/raw/raw3'
/


or with multiple fail groups...
create diskgroup data3
normal redundancy
failgroup controller1 disk '/dev/raw/raw4'
failgroup controller2 disk '/dev/raw/raw6'
/


Add a disk to a group

alter diskgroup data1
add disk '/dev/raw/raw4'
/



Drop a disk group

drop diskgroup '<name>'
/



Is ASM performing a balancing operation

select *
from v$asm_operation
/

Mount/dismount disk groups
alter diskgroup all mount
/
alter diskgroup data1 mount
/
alter diskgroup all dismount
/
alter diskgroup data1 dismount
/

Check the internal consistency of a diskgroup

alter diskgroup data1 check all
/

No comments:

Post a Comment