Manage ASM Disk and diskgroup information in Oracle
Check the Size and free space in ASM Disks
set pagesize 200
set lines 200
set long 1000
col path for a50
col name for a10
col header_Status for a12
col read_mb for 99999.99
col write_mb for 99999.99
select name, path, header_status, total_mb, free_mb, trunc(bytes_read/1024/1024) read_mb, trunc(bytes_written/1024/1024)
write_mb from v$asm_disk;
Check the Size and free space in ASM Diskgroup
col name for a10
col percentage 999.99
SELECT name, free_mb, total_mb, free_mb/total_mb*100 as percentage FROM v$asm_diskgroup;
Check the ASM Disk stats
select * from V$ASM_DISK_IOSTAT;
Mount and Dismount ASM Disk group
--Mount the diskgroup
SQL>alter diskgroup DATA mount;
or
asmcmd>mount DATA
--Unmount the diskgroup
SQL>alter diskgroup DATA dismount;
OR
asmcmd>umount DATA
-- To mount/Dismount all the diskgroups
SQL>alter diskgroup ALL mount;
SQL>alter diskgroup ALL dismount;
Drop the ASM Disk
-----Dropping one disk:
alter diskgroup data drop disk DATA01;
-----Dropping multiple disk:
alter diskgroup data drop disk DATA01,DATA02, DATA03 rebalance power 10;
---- Monitoring the rebalance operation:
select * from v$asm_operation;
Monitor the Rebalance operation
select GROUP_NUMBER,OPERATION,STATE,POWER, ACTUAL,ACTUAL,EST_MINUTES from gv$asm_operation;
--Change power of rebalance
alter diskgroup DATA rebalance power 10;
Drop ASM Disgroup
drop diskgroup DATA including contents;
Create ASM Disk in Linux
-- Check the asm disk is used
#/etc/init.d/oracleasm querydisk /dev/sdb1
Device "/dev/sdb1" is not marked as an ASM disk
-- Create asm disk
# /etc/init.d/oracleasm createdisk DATA /dev/sdb1
Marking disk "DATA" as an ASM disk: [ OK ]
-- Check the asm disk labelling
# /etc/init.d/oracleasm querydisk /dev/sdb1
Device "/dev/sdb1" is marked an ASM disk with the label "DATA"
-- List the asm disks present
# /etc/init.d/oracleasm listdisks
DATA
Create Diskgroup in SQLPLUS
CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK '/dev/sdb*';