Posted on 2007-11-28 10:16 
一步一步努力向上爬 阅读(1534) 
评论(0)  编辑  收藏  所属分类: 
数据库学习 
			
			
		 
		SYBASE ASE查询日志空间使用情况
select 
    s.name, 
    (select max(convert(int,t.status & 1))
    from <YOUR_DATABASE>.dbo.systhresholds t
    where s.segment=t.segment) status, sum(u.size)*2 size,
    sum(u.size - curunreservedpgs(u.dbid, u.lstart, u.unreservedpgs))*2.000/1024 used,
    @@thresh_hysteresis hysteresis
from 
    <YOUR_DATABASE>.dbo.syssegments s, master.dbo.sysusages u
where 
    1 = 1 
    and ((u.segmap / ((s.segment & 1) + 1)) / power(2, (s.segment & 30))) & 1 = 1 
    and u.dbid = db_id('YOUR_DATABASE') and s.name like '%'
group by 
    s.name 
order by 1