SELECT a.tablespace_name
, a.total "Total(Mb)"
, a.total - b.free "Used(Mb)"
, nvl(b.free,0) "Free(Mb)"
, round((a.total - nvl(b.free,0))*100/total,0) "Used(%)"
from (select tablespace_name, round((sum(bytes)/1024/1024),0) as total
from dba_data_files
group by tablespace_name) a
,(select tablespace_name, round((sum(bytes)/1024/1024),0) as free
from dba_free_space
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name(+)
order by a.tablespace_name
, a.total "Total(Mb)"
, a.total - b.free "Used(Mb)"
, nvl(b.free,0) "Free(Mb)"
, round((a.total - nvl(b.free,0))*100/total,0) "Used(%)"
from (select tablespace_name, round((sum(bytes)/1024/1024),0) as total
from dba_data_files
group by tablespace_name) a
,(select tablespace_name, round((sum(bytes)/1024/1024),0) as free
from dba_free_space
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name(+)
order by a.tablespace_name