this is pretty good as well
clear breaks
clear computes
Prompt
Prompt Tablespace Usage
Prompt
SET lines 120 pages 500
col percent_used format 999.99
SELECT a.TABLESPACE_NAME,
NVL(ROUND((a.BYTES /1024)/1024/1024,2),2) GB_TOTAL,
NVL(ROUND((b.BYTES /1024)/1024/1024,2),2) GB_FREE,
NVL(ROUND((b.largest/1024),2),0) KB_Chunk,
NVL(ROUND(((a.BYTES -NVL(b.BYTES,1))/a.BYTES)*100,4),0) percent_used
FROM
(SELECT TABLESPACE_NAME,
NVL(SUM(BYTES),0) BYTES
FROM dba_data_files
GROUP BY TABLESPACE_NAME
) a,
(SELECT TABLESPACE_NAME,
NVL(SUM(BYTES),1) BYTES ,
NVL(MAX(BYTES),1) largest
FROM dba_free_space
GROUP BY TABLESPACE_NAME
) b
WHERE a.TABLESPACE_NAME=b.TABLESPACE_NAME(+)
ORDER BY ((a.BYTES-b.BYTES)/a.BYTES) DESC;
output
TABLESPACE_NAME GB_TOTAL GB_FREE KB_CHUNK PERCENT_USED
------------------------------ ---------- ---------- ---------- ------------
SYSTEM .84 .02 9216 97.36
SYSAUX .57 .05 32768 91.10
UNDOTBS1 .06 .05 36864 23.13
USERS 0 0 4096 20.00