SELECT tablespace_name,sum_m as total_m, ( sum_m- free_m) as used_m,free_m,
to_char(100*(sum_m-free_m)/sum_m, '99.99') || '%' AS pct_used,
to_char(100*free_m/sum_m, '99.99') || '%' AS pct_free
FROM
( SELECT tablespace_name,sum(bytes)/1024/1024 AS sum_m
FROM dba_data_files GROUP BY tablespace_name),
( SELECT tablespace_name AS fs_ts_name,sum(bytes/1024/1024) AS free_m
FROM dba_free_space GROUP BY tablespace_name )
WHERE tablespace_name = fs_ts_name
order by free_m;
to_char(100*(sum_m-free_m)/sum_m, '99.99') || '%' AS pct_used,
to_char(100*free_m/sum_m, '99.99') || '%' AS pct_free
FROM
( SELECT tablespace_name,sum(bytes)/1024/1024 AS sum_m
FROM dba_data_files GROUP BY tablespace_name),
( SELECT tablespace_name AS fs_ts_name,sum(bytes/1024/1024) AS free_m
FROM dba_free_space GROUP BY tablespace_name )
WHERE tablespace_name = fs_ts_name
order by free_m;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23898243/viewspace-689544/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23898243/viewspace-689544/