DBA- Monitoring Database Size in SQL Server

 


-- Script to monitor database size in SQL Server
SELECT 
name AS DatabaseName,                -- Name of the database
SUM(size) * 8 / 1024 AS SizeInMB,    -- Total size in MB
state_desc AS Status                 -- Current status of the database
FROM sys.master_files
GROUP BY name, state_desc
ORDER BY SizeInMB DESC;                  -- Largest databases first

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