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
total
tablespace_name tsname
count(free
bytes) nfrags
nvl(max(free
bytes)/
) mxfrag
total
bytes/
totsiz
nvl(sum(free
bytes)/
) avasiz
(
nvl(sum(free
bytes)
)/total
bytes)*
pctusd
from
dba_data_files total
dba_free_space free
where
total
tablespace_name = free
tablespace_name(+)
group by
total
tablespace_name
total
bytes;
From:http://tw.wingwit.com/Article/program/Oracle/201311/18135.html