Thursday, May 7, 2015

Finding the total disk space and free space where database files resides

SELECT distinct volume_mount_point ,F.name,physical_name
    ,cast(available_bytes as decimal)/ (1024*1024*1024) as [Avaialable_Space_in_GB],cast(total_bytes as decimal)/ (1024*1024*1024) as total_space_in_GB
FROM sys.master_files AS f
CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.file_id)
order by F.name

sys.master_files  and sys.dm_os_volume_stats(f.database_id, f.file_id)

No comments:

Post a Comment