| CesarDBA 2006-04-04, 1:23 pm |
| Hello to all,
I am using this query to get a Sybase database report utilization:
SELECT dbname = d.name
,device_fragments = substring(v.name,1,15)
,usage = substring(m.description, 1, 15)
,total_size_kb = u.size * (sv1.low / 1024)
,free_kb = curunreservedpgs(d.dbid, u.lstart, u.unreservedpgs) *
(sv1.low / 1024)
,free_pct = convert(numeric(5,2)
, round(100.00 *
curunreservedpgs(d.dbid, u.lstart, u.unreservedpgs) / u.size, 2))
,use_pct = convert(numeric(5,2)
, 100 - round(100.00 *
curunreservedpgs(d.dbid, u.lstart, u.unreservedpgs) / u.size, 2))
FROM master.dbo.sysdevices v
,master.dbo.sysusages u
,master.dbo.sysdatabases d
,master.dbo.spt_values sv1
,master.dbo.spt_values sv2
,master.dbo.sysmessages m
WHERE v.status & 2 = 2
AND u.vstart BETWEEN v.low AND v.high
AND d.dbid = u.dbid
AND sv1.number = 1
AND sv1.type = 'E'
AND sv2.type = "S"
AND sv2.number = u.segmap & 7
AND m.error = sv2.msgnum
AND isnull(m.langid, 0) = @@langid
ORDER BY 1, 2, 3
go
The query works very well on my Production database. Recently I copied
the production database to my development database, using dump and load
commands. This query does not work on my development database and even
the sp_helpdb command show all space as available, but this is not
true. The tables/indexes from production are in the development
database.
Anyone have another query to get the available space on my databases or
an option to update the catalog for my development database shows the
correct values?
Thank you in advance,
Cesar
|