select a.tablespace_name,
(nvl(b.alloc_size,0)-nvl(c.free_size,0))/(1024*1024*1024) "USED SIZE(G)",
nvl(c.free_size,0)/(1024*1024*1024) "FREE SIZE(G)",
nvl(b.max_size, 0)/(1024*1024*1024) "MAX SIZE(G)",
round((nvl(b.alloc_size,0)-nvl(c.free_size,0))/nvl(b.alloc_size,0),4)*100||'%' "USED PCT(%)"
from dba_tablespaces a
left join (select tablespace_name,
sum(bytes) as alloc_size,
sum(decode(autoextensible,'YES',maxbytes, 'NO',bytes, 0)) as max_size
from dba_data_files
group by tablespace_name
) b on a.tablespace_name=b.tablespace_name
left join (select tablespace_name,
sum(bytes) as free_size
from dba_free_space
group by tablespace_name
) c on a.tablespace_name=c.tablespace_name
order by 2;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21126685/viewspace-686313/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21126685/viewspace-686313/