Quick check server space and DB size

  • Comments posted to this topic are about the item Quick check server space and DB size

    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Seems to work fine. Thanks.

  • It is a great script and I modified your script below.



    CAST(ROUND(max(vs.total_bytes)/1024.0/1024/1024, 2) as numeric(16,2)) TotalSpaceGB ,

    CAST(ROUND(min(available_bytes)/1024.0/1024/1024, 2) as numeric(16,2)) FreespaceGB ,

    Count(*) as DBFileCount

    from sys.master_files S cross apply Sys.dm_os_volume_stats(s.database_id,s.file_id) vs Group by volume_mount_point



    db_name(database_id) DBName,

    CAST(ROUND(size*8.0/1024, 2) as numeric(16,2)) as SizeMB,


    Name as Logical_Name

    from sys.master_files order by size Desc


    Thank you for your sharing!

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

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