Get Database Sizes in SQL Server

Knowing how much disk space your databases are consuming in SQL Server is an important thing to know and monitor as a Database Administrator. As well as this, we should be looking at future growth of database files, ensuring we have enough disk space for years to come.

It takes more than a few SQL scripts in a blog post to get to know your disk space requirements of a SQL Server. The scripts I provide here do help though, and give a good quick glance at database sizes, including how full the data files are.

There’s many ways to show database sizes in SQL Server. As a DBA, it’s always great to have SQL scripts to get this info which I share below.

SQL Script to Show Database Sizes in SQL Server

The script below will return all databases sizes (MB & GB) for a SQL Server instance:

Get Database Sizes SQL Server

I often bring up the Shrink File window in SSMS as shown above to view the data and log file sizes. From this window we can easily check how full our database file(s) and log files are. .


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts
Categories
Tags

Always On Availability Groups (AAG) (4) AWS (4) AWS Redshift (6) Certificates & Encryption (3) Change Data Capture (CDC) (2) Database Admin (72) Database Backups & Recovery (14) Database Mirroring (2) Error Messages (5) Git Commands (6) Importing & Exporting Data (2) Linked Servers (3) Linux Admin (2) Logging & Monitoring (1) Measuring Databases (10) Microsoft Patching (2) MySQL (4) Postgres (6) PowerShell Scripts (1) SQL Server Agent (5) SQL Server Database Files (1) SQL Server Data Types (2) SQL Server Management Studio (SSMS) (16) SQL Server Network Connectivity (3) SQL Server on Linux (1) SQL Server Patching (2) SQL Server Performance Tuning (6) SQL Server Processes (SPIDs) (7) SQL Server Replication (2) SQL Server Scripts (13) SQL Server Security (3) Windows Admin (21) Windows Authentication (2) Windows Automation (1) Windows Events (2) Windows Firewall (4) Windows Subsystem for Linux (WSL) (18)