Freigeben über


How can I find the actual size of my database so that I know how much space is left and plan accordingly?

The database size is calculated by counting the number of pages in the database that contain their tables, index and objects. This is similar to calculating the size of a database in standard SQL Server – not the disk space consumed by the instance but just the space consumed by each database. Some things that do not affect the size are:

  • Logs are excluded from the size calculation
  • Master DB is excluded from size calculation
  • All other system databases and server catalogs are excluded from the calculations
  • All customer database replicas are excluded from the calculations (we only count one of the three replicas of the customer database

You may use the following Data Management View (DMV) to get an approximate size of the database used:

 SELECT 
SUM(reservered_page_count)*8.0/1024 as ‘SizeInMB’ 
FROM 
sys.dm_db_partition_stats

Comments

  • Anonymous
    January 03, 2016
    Thanks for query, Small correction from above query, instead of reservered_page_count it should be reserved_page_count. column.