Technical Article

Quick check server space and DB size

,

Use management studio and run it in new query window. You need sysadmin or atleast a view definition permission.

Addditionally you can add this in your query shortcuts as I have done.

It will give two result sets, first one with all the drives used by sql server files and available free space. second one with database file size in size descending.

Select  volume_mount_point,max(vs.total_bytes) /1024.0/1024/1024 TotalSpaceGB ,min(available_bytes)/1024.0/1024/1024 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

Go
Select physical_name,name, db_name(database_id) DBName,size*8.0/1024 SizeMB, Name from sys.master_files order by size Desc
Go

Rate

4.14 (7)

You rated this post out of 5. Change rating

Share

Share

Rate

4.14 (7)

You rated this post out of 5. Change rating