top of page

Volume info for all databases on the current instance SQL Server

-- Volume info for all databases on the current instance (SQL Server 2008 R2 SP1 or greater)

SELECT DB_NAME(f.database_id) AS [DatabaseName], f.file_id,

vs.volume_mount_point, vs.total_bytes/1024000000 Total_Drive_Space_GB, vs.available_bytes/1024000000 Available_GB,

CAST(CAST(vs.available_bytes AS FLOAT)/ CAST(vs.total_bytes AS FLOAT) AS DECIMAL(18,1)) * 100 AS [Space_Available%]

FROM sys.master_files AS f

CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.file_id) AS vs

ORDER BY f.database_id OPTION (RECOMPILE);

2 views0 comments

Recent Posts

See All

SQL Server Profiler Trace

--Import multiple trace file in sql Table. --All the rollover files will be automatically imported --provide number tracefile to capture...

댓글


bottom of page