Tuesday, January 29, 2013

Query ASM Disks and Diskgroups

List all ASM devices:
/etc/init.d/oracleasm querydisk -d `/etc/init.d/oracleasm listdisks -d` |
 cut -f2,10,11 -d" " | perl -pe 's/"(.*)".*\[(.*), *(.*)\]/$1 $2 $3/g;'


List all AVAILABLE ASM disks:
col path format a20
col header_status format a13
col os_mb format 999,999,999 heading 'Size (MB)'
SELECT inst_id, 
       path, 
       header_status, 
       os_mb 
  FROM GV$ASM_DISK 
 WHERE header_status in ('FORMER','PROVISIONED')
 ORDER BY path,
          inst_id;

Sample Output:
INST_ID  PATH                 HEADER_STATUS    Size (MB)
-------- -------------------- ------------- ------------
       1 ORCL:DISK25          FORMER             524,294
       2 ORCL:DISK25          FORMER             524,294
       1 ORCL:DISK26          FORMER             524,294
       2 ORCL:DISK26          FORMER             524,294
       1 ORCL:DISK30          FORMER             524,294
       2 ORCL:DISK30          FORMER             524,294
       1 ORCL:DISK33          PROVISIONED        524,294
       2 ORCL:DISK33          PROVISIONED        524,294


List All ASM DISKGROUPS:
set pagesize 60
set linesize 132
column aa format 99999 heading "DiskGroup"
column ab format a15 heading "DiskGroup"
column ac format a20 heading "Disk"
column ad format a15 heading "DiskGroup State"
column ae format a15 heading "Disk State"
break on ab skip 1
select substr(to_char(a.group_number),1,5) aa, substr(a.name,1,15) ab, substr(b.name,1,20) ac , b.total_mb, b.free_mb, a.state ad, b.state ae from
v$asm_diskgroup a, v$asm_disk b
where a.group_number = b.group_number
--and a.group_number = 4
order by 2,3
/

Sample Output:
DiskG DiskGroup       Disk              TOTAL_MB    FREE_MB DiskGroup State Disk State
----- --------------- --------------- ---------- ---------- --------------- ---------------
1     DATA            DATA1               517893     183780 MOUNTED         NORMAL
1                     DATA2               517893     183783 MOUNTED         NORMAL
1                     DATA3               517893     183781 MOUNTED         NORMAL
1                     DATA4               517893     183781 MOUNTED         NORMAL
1                     DATA5               517893     183780 MOUNTED         NORMAL
2     FRA             FRA1                517893     426005 MOUNTED         NORMAL
3     VOTING          VOTING                8631       8235 MOUNTED         NORMAL


Rebalance Operations:
11g
select inst_id, 
       operation, 
       state, 
       power, 
       sofar, 
       est_work, 
       est_rate, 
       est_minutes 
  from gv$asm_operation 
 order by inst_id, state
/

12c
select inst_id, 
       pass,
       state, 
       power, 
       sofar, 
       est_work, 
       est_rate, 
       est_minutes 
  from gv$asm_operation 
 order by inst_id, state
/

12c added a "COMPACT" pass to improve disk seek performance.

Sample Output:
   INST_ID OPERA STAT      POWER      SOFAR   EST_WORK   EST_RATE EST_MINUTES
---------- ----- ---- ---------- ---------- ---------- ---------- -----------
         1 REBAL RUN           5     314121     314121       1029           0
         1 REBAL WAIT          5
         2 REBAL RUN           5       9724     188000       1289         138
         2 REBAL WAIT          5

Query Disk Compatibility:
col COMPATIBILITY form a10
col DATABASE_COMPATIBILITY form a10
col NAME form a20
select group_number, name, compatibility, database_compatibility from v$asm_diskgroup;

Additional reference:
How To Gather & Backup ASM/ACFS Metadata In A Formatted Manner version 10.1, 10.2, 11.1, 11.2 and 12.1? (Doc ID 470211.1)

No comments:

Post a Comment