ITPub博客

首页 > 数据库 > 数据库开发技术 > 查询表空间的使用率

查询表空间的使用率

原创 数据库开发技术 作者:kendyhxl 时间:2007-03-20 23:17:55 0 删除 编辑

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;

本方法来自:

http://www.itpub.net/739945.html

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8683736/viewspace-906102/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: oracle分析函数
请登录后发表评论 登录
全部评论
  • 博文量
    21
  • 访问量
    47656