Calculate database size ‘Growth Rates’ on daily basis in SQL Server

Introduction

To calculate database size ‘Growth Rates‘ on a daily basis in SQL Server we need to track database size changes every day. The best solution is to check the database size daily and compare with previous data. We may setup a job in SQL Server and gather the information daily.

Create a database

Use below TSQL script or SSMS and create a database ‘REPORT_DB’ to store daily tracked database growth data.

Database size

Now run the below script to collect current database size & store in table ‘DBSizeDailyReport’ within ‘REPORT_DB’ database.

Check the table

We can check the table within the REPORT_DB database.

If we run select * from DBSizeDailyReport in the REPORT_DB database below result will be shown.

Job & schedule

Now to run the main script daily we may create a job & schedule the job.

So, after a week or month if we check the table we will get the individual day database size. Simply we can compare the date and calculate the database growth rate easily.

 


Comments

Leave a Reply

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