Chinaunix首页 | 论坛 | 博客
  • 博客访问: 267907
  • 博文数量: 82
  • 博客积分: 2502
  • 博客等级: 少校
  • 技术积分: 842
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-04 15:13
文章分类

全部博文(82)

文章存档

2011年(3)

2009年(25)

2008年(54)

我的朋友

分类: 数据库开发技术

2009-08-21 15:24:00

 脚本如下,具体就不再赘述。
 

replace macro all_dataspace as (   --采用宏,下次可以直接调用
    select cast(trim(databasename) as char(20)) || '|' (title 'name')
      ,cast(trim(cast(sum(currentperm)/1024/1024/1024 as int) || 'G') as char(5)) || '|' (title 'curr(G)')
      ,cast(trim(cast(sum(maxperm)/1024/1024/1024 as int) || 'G')as char(6)) || '|' (title 'max(G)')
      ,cast(trim(cast(sum(maxperm)/1024/1024/1024 as int)-cast(sum(currentperm)/1024/1024/1024 as int) || 'G')as char(6)) || '|' (title 'spare(G)')
      ,sum(currentperm)*100/nullifzero(sum(maxperm)) (format 'zz9.99%',title 'per(%)')
     from dbc.diskspace
   
     group by 1
     order by 4 desc;
     );

--计算表空间
sel cast(trim(cast(sum(currentperm)/1024/1024/1024 as int) || 'G') as char(5)),tablename,databasename from dbc.tablesize where databasename='dwpdata' and tablename in
('Atable','Btable','Ctable','Dtable','Etable') group by 2,3

阅读(4384) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~