Free space tablespace
SELECT SUBSTR(TABLESPACE_NAME, 1, 40) TABLESPACE,
CASE
WHEN USED_PERCENT >= 95 THEN
'CRITICO'
WHEN USED_PERCENT >= 75 THEN
'ATENÇÃO'
ELSE
'NORMAL'
END ALERTA,
-- % USED
ROUND(USED_PERCENT, 2) USED_PERCENT,
TABLESPACE_SIZE TABLESPACE_BLOCKS,
--USED_SPACE
ROUND((USED_SPACE * 8192) / (1024 * 1024), 2) USED_MB,
ROUND(((USED_SPACE * 8192) / (1024 * 1024) / 1024), 2) USED_GB,
--TABLESPACE_SIZE
ROUND((TABLESPACE_SIZE * 8192) / (1024 * 1024), 2) TABLESPACE_EXT_MB,
ROUND(((TABLESPACE_SIZE * 8192) / (1024 * 1024) / 1024), 2) TABLESPACE_EXT_GB,
ROUND((((TABLESPACE_SIZE * 8192) / (1024 * 1024) / 1024) -
((USED_SPACE * 8192) / (1024 * 1024) / 1024)),
2) RESTANTE_GB
FROM DBA_TABLESPACE_USAGE_METRICS X
ORDER BY USED_PERCENT DESC;