Difference in actual usage and disk utilized for Microsoft SQL Server 2012

98 Views Asked by At

I am trying to monitor database utilization for one of our applications. Issues observed are that actual utilized disk space by the database is more than the result we got by checking the utilization by using the below query.

Utilized space by the database is around 250 GB and the result we got from the below query is 190 Gb.

The database used in the backend is Microsoft SQL Server 2012.

Please find the query below which I used to check the disk utilized by a database.

SELECT DISTINCT
    SERVERPROPERTY('MachineName') AS MachineName
    , ISNULL(SERVERPROPERTY('InstanceName'), 'MSSQLSERVER') AS InstanceName
    , vs.volume_mount_point AS VolumeName
    , vs.logical_volume_name AS VolumeLabel
    , vs.total_bytes AS VolumeCapacity
    , vs.available_bytes AS VolumeFreeSpace
    , CAST(vs.available_bytes * 100.0 / vs.total_bytes AS DECIMAL(5, 2)) AS PercentageFreeSpace
FROM
    sys.master_files AS mf
CROSS APPLY 
    sys.dm_os_volume_stats(mf.database_id, mf.file_id) AS vs;

As I don't know much about databases, I found above query just by searching on Google.

Please help figuring out is there any other usage by database because we have dedicated disk for our database.

Regards, Nitesh.

0

There are 0 best solutions below