Take into account "data and log" segments to avoid negative values for log usage
See http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc31644.1550/html/sag2/sag2175.htm
This commit is contained in:
parent
5843bcb4ae
commit
9496759c81
|
@ -157,8 +157,8 @@ sub manage_selection {
|
|||
select db_name(d.dbid) as db_name,
|
||||
ceiling(sum(case when u.segmap != 4 then u.size/1.*@@maxpagesize end )) as data_size,
|
||||
ceiling(sum(case when u.segmap != 4 then size - curunreservedpgs(u.dbid, u.lstart, u.unreservedpgs) end)/1.*@@maxpagesize) as data_used,
|
||||
ceiling(sum(case when u.segmap = 4 then u.size/1.*@@maxpagesize end)) as log_size,
|
||||
ceiling(sum(case when u.segmap = 4 then u.size/1.*@@maxpagesize end) - lct_admin("logsegment_freepages",d.dbid)/1.*@@maxpagesize) as log_used
|
||||
ceiling(sum(case when u.segmap in (4, 7) then u.size/1.*@@maxpagesize end)) as log_size,
|
||||
ceiling(sum(case when u.segmap in (4, 7) then u.size/1.*@@maxpagesize end) - lct_admin("logsegment_freepages",d.dbid)/1.*@@maxpagesize) as log_used
|
||||
from master..sysdatabases d, master..sysusages u
|
||||
where u.dbid = d.dbid and d.status not in (256,4096)
|
||||
group by d.dbid
|
||||
|
|
Loading…
Reference in New Issue