SELECT g.group_number "Group" , g.name "Group Name" , g.state "State" , g.type "Type" , g.total_mb/1024 "Total GB" , g.free_mb/1024 "Free GB" , 100*(max((d.total_mb-d.free_mb)/d.total_mb)-min((d.total_mb-d.free_mb)/d.total_mb))/max((d.total_mb-d.free_mb)/d.total_mb) "Imbalance"
from web
set linesize 300
sset term on
SSET numf 999,999
DEFINE size_label=GB
DEFINE size_divider="1024/1024/1024"
PROMPT **********************************************************************
PROMPT * A S M D I S K G R O U P S P A C E U S A G E R E P O R T *
PROMPT **********************************************************************
COLUMN NAME HEAD "DiskGroup" FORMAT A16
COLUMN group_number HEAD "G#" FORMAT 99
COLUMN type HEAD "Redundancy|Type" FORMAT A6
COLUMN compatibility HEAD "ASM|Compat" FORMAT A10
COLUMN database_compatibility HEAD "RDBMS|Compat" FORMAT A10
COLUMN allocation_unit_size_MB HEAD "AU|Size|(MB)" FORMAT 999
COLUMN offline_disks HEAD "Offline|Disks"
COLUMN separator HEAD "!|!|!|!|!|!" FORMAT a1
COLUMN mirrored_total_GB HEAD "(E)||Mirrored|Total|(&size_label)"
COLUMN USABLE_TOTAL_GB HEAD "(A-D)|/REDUN||Safely|Usable|Total|(&size_label)"
COLUMN USABLE_USED_GB HEAD "(B-D)|/REDUN||Safely|Usable|Used|(&size_label)"
COLUMN USABLE_FREE_GB HEAD "(C-D)|/REDUN||Safely|Usable|Free|(&size_label)"
COLUMN USABLE_USED_PERCENT HEAD "Safely|Usable|Used|(%)" FORMAT 999.99
COLUMN USABLE_FREE_PERCENT HEAD "Safely|Usable|Free|(%)" FORMAT 999.99
COLUMN mirrored_free_GB HEAD "Mirrored|Free|(&size_label)"
COLUMN REQUIRED_MIRROR_FREE_GB HEAD "(D)|Required|Free|ForMirror|(&size_label)" JUSTIFY RIGHT
COLUMN TOTAL_GB HEAD "(A)||Total|Avail|(&size_label)"
COLUMN used_GB HEAD "(B)||Total|Used|(&size_label)"
COLUMN hot_used_GB HEAD "Hot|Used|(&size_label)"
COLUMN cold_used_GB HEAD "Cold|Used|(&size_label)"
COLUMN FREE_GB HEAD "(C)||Total|Free|(&size_label)"
BREAK ON REPORT
COMPUTE SUM LABEL 'Total' OF TOTAL_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF USED_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF HOT_USED_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF COLD_USED_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF FREE_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF REQUIRED_MIRROR_FREE_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF MIRRORED_TOTAL_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF MIRRORED_USED_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF MIRRORED_FREE_GB FORMAT 99,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF USABLE_GB FORMAT 9,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF USABLE_TOTAL_GB FORMAT 9,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF USABLE_USED_GB FORMAT 9,999,999 ON REPORT
COMPUTE SUM LABEL 'Total' OF USABLE_FREE_GB FORMAT 9,999,999 ON REPORT
PROMPT
PROMPT . <----------------------- With Mirroring ----------------------> <-------------------- Without Mirroring ---------------->
-- Note:
-- The GROUP_NUMBER, TOTAL_MB, and FREE_MB columns are only
-- meaningful if the disk group is mounted by the instance. Otherwise, their values will be 0.
SELECT NAME
, group_number
, type
, '!' separator
, ROUND(TOTAL_MB/DECODE(type,'EXTERN',1,'NORMAL',2,'HIGH',3)/1024) mirrored_TOTAL_GB
, ROUND((TOTAL_MB - REQUIRED_MIRROR_FREE_MB )/DECODE(type,'EXTERN',1,'NORMAL',2,'HIGH',3)/1024) USABLE_TOTAL_GB
, ROUND((hot_used_mb + cold_used_mb)/DECODE(type,'EXTERN',1,'NORMAL',2,'HIGH',3) /1024) USABLE_USED_GB
, ROUND(USABLE_FILE_MB /1024) USABLE_FREE_GB
, ROUND((USABLE_FILE_MB + ROUND(REQUIRED_MIRROR_FREE_MB/DECODE(type,'EXTERN',1,'NORMAL',2,'HIGH',3)) ) /1024) mirrored_free_GB
, ROUND( (hot_used_mb + cold_used_mb) / (TOTAL_MB - REQUIRED_MIRROR_FREE_MB ) * 100 , 2) USABLE_USED_PERCENT
, ROUND(USABLE_FILE_MB /((TOTAL_MB - REQUIRED_MIRROR_FREE_MB )/DECODE(type,'EXTERN',1,'NORMAL',2,'HIGH',3)) * 100 ,2) USABLE_FREE_PERCENT
, '!' separator
, ROUND(REQUIRED_MIRROR_FREE_MB/1024) REQUIRED_MIRROR_FREE_GB
, ROUND(TOTAL_MB/1024) TOTAL_GB
, ROUND((hot_used_mb + cold_used_mb) /1024) USED_GB
, ROUND(hot_used_mb/1024) HOT_USED_GB
, ROUND(cold_used_mb/1024) COLD_USED_GB
, ROUND(FREE_MB/1024) FREE_GB
, '!' separator
FROM v$asm_diskgroup_stat;