Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2874994
  • 博文数量: 200
  • 博客积分: 2413
  • 博客等级: 大尉
  • 技术积分: 3067
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-01 22:07
文章分类

全部博文(200)

文章存档

2018年(2)

2017年(8)

2016年(35)

2015年(14)

2014年(20)

2013年(24)

2012年(53)

2011年(44)

分类: Oracle

2012-01-27 20:16:40

跟踪每天的数据量,还可以统计周和月的增量情况,预计未来存储需求以kb为单位
  1. select name,
  2. sum(case substr(rtime,1,10) when '12/23/2011' then diff else null end) as "20111223",
  3. sum(case substr(rtime,1,10) when '12/24/2011' then diff else null end) as "20111224",
  4. sum(case substr(rtime,1,10) when '12/25/2011' then diff else null end) as "20111225",
  5. sum(case substr(rtime,1,10) when '12/26/2011' then diff else null end) as "20111226",
  6. sum(case substr(rtime,1,10) when '12/27/2011' then diff else null end) as "20111227",
  7. sum(case substr(rtime,1,10) when '12/28/2011' then diff else null end) as "20111228",
  8. sum(case substr(rtime,1,10) when '12/29/2011' then diff else null end) as "20111229"
  9. from (
  10. select t.name,
  11. h.tablespace_usedsize,
  12. h.rtime,
  13. (h.tablespace_usedsize - lag(h.tablespace_usedsize,1,null)
  14. over(partition by tablespace_id order by snap_id)) as diff
  15. from v$tablespace t, dba_hist_tbspc_space_usage h
  16. where t.ts#=h.tablespace_id)
  17. group by name
  18. order by 1;
阅读(1852) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~