Posted on 2007-11-28 10:16
一步一步努力向上爬 閱讀(1522)
評論(0) 編輯 收藏 所屬分類:
數(shù)據(jù)庫學(xué)習(xí)
SYBASE ASE查詢?nèi)罩究臻g使用情況
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