前端之家收集整理的这篇文章主要介绍了
查询表空间使用情况,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_
301_0@##
查询语句
select upper(f.tablespace_name) as tablespace_name,d.tot_grootte_mb as "Size(MB)",f.total_bytes as "Free size(MB)",d.tot_grootte_mb - f.total_bytes as "Already in use(MB)",round((d.tot_grootte_mb - f.total_bytes) / d.tot_grootte_mb * 100,2) as "Percent used(%)",round(d.maxbytes / 1024) as "Maximum value(GB)",round((d.tot_grootte_mb - f.total_bytes) / d.maxbytes * 100,2) as "Percent of maximum value%"
from (select tablespace_name,round(sum(bytes) / (1024 * 1024),2) total_bytes
from sys.dba_free_space
group by tablespace_name) f,(select dd.tablespace_name,round(sum(dd.bytes) / (1024 * 1024),2) tot_grootte_mb,round(sum(case
when dd.autoextensible = 'YES' then
dd.maxbytes
else
dd.bytes
end) / (1024 * 1024),2) maxbytes
from sys.dba_data_files dd
group by dd.tablespace_name) d
where d.tablespace_name = f.tablespace_name
order by tablespace_name;