Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7305954
  • 博文数量: 444
  • 博客积分: 10593
  • 博客等级: 上将
  • 技术积分: 3852
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-09 15:26
文章分类

全部博文(444)

文章存档

2014年(1)

2013年(10)

2012年(18)

2011年(35)

2010年(125)

2009年(108)

2008年(52)

2007年(72)

2006年(23)

分类: DB2/Informix

2010-03-01 10:56:54

1.
select
        name dbspace ,
        round(sum(chksize)/512) allocated_m,
        round((sum(chksize) - sum(nfree))/512) used_m ,
        round(sum(nfree)/512) free_m,
        round(((sum(chksize) - sum(nfree))/sum(chksize))*100)||"%" pcused
from sysdbspaces d, syschunks c
where d.dbsnum = c.dbsnum
group by name
order by name
2.
select round(sum(a.nfree)/512,0) free_dbs,
round(sum(a.chksize)/512,0) total_size,
b.name dbspace_name
from syschunks a,sysdbspaces b
where a.dbsnum=b.dbsnum and a.dbsnum<>2 and a.dbsnum<>3
group by 3
order by 1 desc

3.如果还想看某dbspace上都有那些表,可以用 oncheck -pe dbspace_name
4.查看数据库中表的大小
select dbsname,tabname,sum(pe_size)*4/1024
from systabnames,sysptnext
where partnum=pe_partnum
--and tabname='table_name'--(table_name为要查询的表名)
and dbsname='datadase'
group by tabname,dbsname
order by 3 desc
5、查看数据空间中数据库的大小
 

select s.name,  e.dbsname,          sum(e.size/256) usedM --IBM/256 HP/512

  from sysextents e,syschunks c,sysdbspaces s

where e.chunk=c.chknum and c.dbsnum=s.dbsnum

and s.name=’dataspace’---此处可修改

group by 1,2

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

chinaunix网友2010-07-28 16:19:14

注意每页2k,所以如果是以M为单位就/512,如果是4k,那么应该是/256