select a.TS1,
(1-(b.SUM_B2/a.SUM_B1))*100 b4,
(b.SUM_B2/a.SUM_B1)*100 b5,
a.SUM_B1,
a.SUM_B1 - b.SUM_B2 b3,
b.SUM_B2,
b.MAX_B2 b6,
b.CNT_B2 b7
FROM
(select tablespace_name TS1,
sum(bytes) SUM_B1
from dba_data_files
group by tablespace_name) a,
(select tablespace_name TS2,
sum(bytes) SUM_B2,
max(bytes) MAX_B2,
count(bytes) CNT_B2
from dba_free_space
group by tablespace_name) b
where a.TS1=b.TS2;
或者:
select a.tablespace_name "tablespace",trunc(a.total) "allocated(M)",ceil((1-b.free/a.total)*100) "Usage %",
trunc(b.free) " free space(M)" from
(select tablespace_name, sum(nvl(bytes,0))/1024/1024 total from dba_data_files group by tablespace_name) a,
(select tablespace_name, sum(nvl(bytes,0))/1024/1024 free from dba_free_space group by tablespace_name) b
where a.tablespace_name=b.tablespace_name order by 3 desc;
本方法来自:
[@more@]来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8683736/viewspace-906102/ ,如需转载,请注明出处,否则将追究法律责任。