select Total.Tname "表空间名称",
Total.Total_Size "表空间大小",
Total.Total_Size - Used.free_size as "已使用大小",
Used.Free_size as 表空间剩余大小,
Round((Total.Total_Size - Used.free_size) / Total.Total_Size, 4) * 100 || '%' as 表空间使用率
from (
-- 表空间数据文件的大小
select tablespace_name as TName,
round(sum(user_bytes) / (1024 * 1024), 1) as Total_size
from dba_data_files
group by tablespace_name) Total,
(
-- 表空间剩余的大小
select tablespace_name as TName,
round(sum(bytes) / (1024 * 1024), 1) as Free_size
from dba_free_space
group by tablespace_name) Used
where Total.TName = Used.TName(+)
查询表空间的使用率
最新推荐文章于 2024-07-09 15:47:32 发布