SELECT * FROM (select *
from
(select a.TABLESPACE_NAME TABLESPACE_NAME,(a.total || 'M') AS "SUM_SPACE",(b.free_space||'M') AS "FREE_SPACE",((a.total-b.free_space)||'M') AS "USED_SPACE",ROUND((a.total-b.free_space)/a.total*100,2) as "USED_RATE"
from
(select TABLESPACE_NAME,sum(bytes/1024/1024) total from dba_data_files group by TABLESPACE_NAME) a,
(select TABLESPACE_NAME,sum(bytes/1024/1024) free_space from dba_free_space group by tablespace_name) b
where a.TABLESPACE_NAME=b.TABLESPACE_NAME order by "USED_RATE" desc)
UNION all
select *
from
(select c.TABLESPACE_NAME TABLESPACE_NAME,(c.total || 'M') AS "SUM_SPACE",(d.free_space||'M') AS "FREE_SPACE",((c.total-d.free_space)||'M') AS "USED_SPACE",ROUND((c.total-d.free_space)/c.total*100,2) as "USED_RATE"
from
(select TABLESPACE_NAME,sum(bytes/1024/1024) total from dba_temp_files group by TABLESPACE_NAME) c,
(select TABLESPACE_NAME,sum(FREE_SPACE/1024/1024) free_space from dba_temp_free_space group by tablespace_name)d
where c.TABLESPACE_NAME=d.TABLESPACE_NAME order by "USED_RATE" desc)
) X order by "USED_RATE" desc;
from
(select a.TABLESPACE_NAME TABLESPACE_NAME,(a.total || 'M') AS "SUM_SPACE",(b.free_space||'M') AS "FREE_SPACE",((a.total-b.free_space)||'M') AS "USED_SPACE",ROUND((a.total-b.free_space)/a.total*100,2) as "USED_RATE"
from
(select TABLESPACE_NAME,sum(bytes/1024/1024) total from dba_data_files group by TABLESPACE_NAME) a,
(select TABLESPACE_NAME,sum(bytes/1024/1024) free_space from dba_free_space group by tablespace_name) b
where a.TABLESPACE_NAME=b.TABLESPACE_NAME order by "USED_RATE" desc)
UNION all
select *
from
(select c.TABLESPACE_NAME TABLESPACE_NAME,(c.total || 'M') AS "SUM_SPACE",(d.free_space||'M') AS "FREE_SPACE",((c.total-d.free_space)||'M') AS "USED_SPACE",ROUND((c.total-d.free_space)/c.total*100,2) as "USED_RATE"
from
(select TABLESPACE_NAME,sum(bytes/1024/1024) total from dba_temp_files group by TABLESPACE_NAME) c,
(select TABLESPACE_NAME,sum(FREE_SPACE/1024/1024) free_space from dba_temp_free_space group by tablespace_name)d
where c.TABLESPACE_NAME=d.TABLESPACE_NAME order by "USED_RATE" desc)
) X order by "USED_RATE" desc;
col TABLESPACE_NAME for a10;
col SUM_SPACE for a10;
col FREE_SPACE for a10;
col USED_SPACE for a10;