返回顶部

欢迎来到菜鸟大明儿哥的博客

我们一起交流学习,不断提升自我

Oracle 查看表空间使用率

 

SELECT Upper(F.TABLESPACE_NAME) "TablespaceName",
D.TOT_GROOTTE_MB "Total(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "Used(M)",
To_char(Round(( D.TOT_GROOTTE_MB - F.TOTAL_BYTES ) / D.TOT_GROOTTE_MB * 100, 2), '990.99')
|| '%' "Used%",
F.TOTAL_BYTES "Free(M)",
F.MAX_BYTES "max_block(M)"
FROM (SELECT TABLESPACE_NAME,
Round(Sum(BYTES) / ( 1024 * 1024 ), 2) TOTAL_BYTES,
Round(Max(BYTES) / ( 1024 * 1024 ), 2) MAX_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
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY 1

 

 

 

posted @ 2021-12-22 17:56  菜鸟大明儿哥  阅读(1257)  评论(0编辑  收藏  举报