col tsname format a justify c heading Tablespace
col nfrags format justify c heading Free|Frags
col mxfrag format justify c heading Largest|Frag (KB)
col totsiz format justify c heading Total|(KB)
col avasiz format justify c heading Available|(KB)
col pctusd format justify c heading Pct|Used
select
totaltablespace_name tsname
count(freebytes) nfrags
nvl(max(freebytes)/) mxfrag
totalbytes/ totsiz
nvl(sum(freebytes)/) avasiz
(nvl(sum(freebytes))/totalbytes)* pctusd
from
dba_data_files total
dba_free_space free
where
totaltablespace_name = freetablespace_name(+)
group by
totaltablespace_name
totalbytes;