DBA-Database mdf & ldf files size, used space, Free space in MB



Use DB_Name-- Mention database name to get the details 
go
select
name
, filename,
(growth/1024) as Growth_MB
, convert(decimal(12,3),round(sf.size/128.00,2)) as FileSize_MB
, convert(decimal(12,3),round(fileproperty(sf.name,'SpaceUsed')/128.00,2)) as SpaceUsed_MB
, convert(decimal(12,3),round((sf.size-fileproperty(sf.name,'SpaceUsed'))/128.00,2)) as FreeSpace_MB 
from dbo.sysfiles sf 


Comments

Popular posts from this blog

DBA - Check health and status of Always On or Availability Group using DMVs

DBA - Script out the Linked server objects.

SQLDBA_ Failover -Registry Check Pointing a Windows Cluster to Bring SQL Server Online