text: -- +----------------------------------------------------------------------------+
  -- |                          Jeffrey M. Hunter                                 |
  -- |                      jhunter@idevelopment.info                             |
  -- |                         www.idevelopment.info                              |
  -- |----------------------------------------------------------------------------|
  -- |      Copyright (c) 1998-2012 Jeffrey M. Hunter. All rights reserved.       |
  -- |----------------------------------------------------------------------------|
  -- | DATABASE : Oracle                                                          |
  -- | FILE     : asm_diskgroups.sql                                              |
  -- | CLASS    : Automatic Storage Management                                    |
  -- | PURPOSE  : Provide a summary report of all disk groups.                    |
  -- | NOTE     : As with any code, ensure to test this script in a development   |
  -- |            environment before attempting to run it in production.          |
  -- +----------------------------------------------------------------------------+
  
  SET TERMOUT OFF;
  COLUMN current_instance NEW_VALUE current_instance NOPRINT;
  SELECT rpad(sys_context('USERENV', 'INSTANCE_NAME'), 17) current_instance FROM dual;
  SET TERMOUT ON;
  
  PROMPT 
  PROMPT +------------------------------------------------------------------------+
  PROMPT | Report   : ASM Disk Groups                                             |
  PROMPT | Instance : &current_instance                                           |
  PROMPT +------------------------------------------------------------------------+
  
  SET ECHO        OFF
  SET FEEDBACK    6
  SET HEADING     ON
  SET LINESIZE    180
  SET PAGESIZE    50000
  SET TERMOUT     ON
  SET TIMING      OFF
  SET TRIMOUT     ON
  SET TRIMSPOOL   ON
  SET VERIFY      OFF
  
  CLEAR COLUMNS
  CLEAR BREAKS
  CLEAR COMPUTES
  
  COLUMN group_name             FORMAT a25           HEAD 'Disk Group|Name'
  COLUMN sector_size            FORMAT 99,999        HEAD 'Sector|Size'
  COLUMN block_size             FORMAT 99,999        HEAD 'Block|Size'
  COLUMN allocation_unit_size   FORMAT 999,999,999   HEAD 'Allocation|Unit Size'
  COLUMN state                  FORMAT a11           HEAD 'State'
  COLUMN type                   FORMAT a6            HEAD 'Type'
  COLUMN total_mb               FORMAT 999,999,999   HEAD 'Total Size (MB)'
  COLUMN used_mb                FORMAT 999,999,999   HEAD 'Used Size (MB)'
  COLUMN pct_used               FORMAT 999.99        HEAD 'Pct. Used'
  
  BREAK ON report ON disk_group_name SKIP 1
  
  COMPUTE sum LABEL "Grand Total: " OF total_mb used_mb ON report
  
  SELECT
      name                                     group_name
    , sector_size                              sector_size
    , block_size                               block_size
    , allocation_unit_size                     allocation_unit_size
    , state                                    state
    , type                                     type
    , total_mb                                 total_mb
    , (total_mb - free_mb)                     used_mb
    , ROUND((1- (free_mb / total_mb))*100, 2)  pct_used
  FROM
      v$asm_diskgroup
  WHERE
      total_mb != 0
  ORDER BY
      name
  /
  
  