Database Size Calculations

This post falls firmly in the category of blocking and tackling, but is a question we all have to answer from time to time: “How big is this database?”

Two methods:

    DB_NAME(database_id) AS DatabaseName
  , Name AS Logical_Name
  , Physical_Name
  , ( CAST( SIZE AS BIGINT ) * 8 ) / 1024 / 1024 SizeGB


EXEC sp_helpdb

Both will get you size per database. The former allows you to see the breakdown of all files (the cast to BIGINT is for really large databases), and the latter returns the sum of all data and log files per database.

This entry was posted in SQL Server Development, SQL Toolbox. Bookmark the permalink.

Leave a Reply

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