select a.tablespace_name,
totalspace,
nvl(freespace, 0) freespace,
(totalspace - nvl(freespace, 0)) used,
((totalspace - nvl(freespace, 0)) / totalspace) * 100 "%USED"
from (select tablespace_name, sum(bytes) / 1048576 totalspace
from dba_data_files
group by tablespace_name) a,
(select tablespace_name, sum(Bytes) / 1048576 freespace
from dba_free_space
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name(+)
and ((totalspace - nvl(freespace, 0)) / totalspace) * 100 > 90
--and nvl(freespace,0) < 1000 -- only list TSs < 1GB free
order by 5 desc;