how to monitor the DB used and unallocated space?

  • I try to write some scripts to monitor the db space usage, i found i can use:

     USE [mydbname]

    sp_spaceused @updateusage = 'TRUE

    to get the db usage info, but the db statistic update may take some time (say more than a minute) to finish.

    since i would like to monitor all dbs space usage and would like to schedule it every 10 minutes, thus i can not afford the updateusage take so long to finish. Since i can find the space usage info from the db taskpad view in enterprise mananger, i'm wondering where that information coming from? is it coming from a sys tables?

    sysindexes is also depends on the updateusage.

    any idea about how to monitor the db space usage?

  •  

    Taskpad view gets data from sysfiles

    Select CONVERT(VARCHAR(12),getdate(),111),Name,Size,FileName from Pubs.dbo.sysfiles

    Kindest Regards,

    Sameer Raval [Sql Server DBA]
    Geico Insurance
    RavalSameer@hotmail.com

  • Thanks for your reply. I'm looking for the Used and Unallocated DB space info which is available in the taskpad but not in the sysfiles, your solution doesn't provide such info.

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply