SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Track database growth

By Irwan Tjanterik,


I think it is time for me to start contributing script which I have written and hopefully you may find this script useful to keep track your database growth and to be aware of when you are going to run out of space.

Basically the script is used for the following:

- Keeping Track of your Database file sizes (MDF,NDF or LDF) .

- Calculate the size of the file when it grows, depending on the setting (% or MB growth), so you will know if you are running out of drive space, so preventable steps can be taken beforehand.

- Can be used for capacity planning based on the used size not the file size, e.g. your database may have 100GB mdf size, but only 40% is currently used.

- Gives you information of current empty percentage,as I always try to ensure we have 20% of free space and increase it during off-peak hours when it is needed.

The script is tested on SQL 2000, 2005 & 2008 & it will provide the following column:

- DBName : Database Name

- FileLogicalName : File Logical Name

- Filename : Database Filename

- FileMBSize : Current File Size in MB

- FileGrowth : Types of the growth, e.g. increase by 5% or 50MB

- FileMBGrowth : Size of the file when after it grows based on the Filegrowth type

- DriveName : DriveName Location

- DriveMBEmpty : Freespace size of your current drive in MB

- FileMBused : Current size of the file being used, you may have 100GB where you only used 80GB

- FileMBEmpty : Unused space size of the file

- FilePercentEmpty : Unused space size of the file in percentage

Total article views: 10289 | Views in the last 30 days: 2
Related Articles

Database Growth

Database Growth Settings


Database growth

Database growth


Space Used by Database Files

Retrieve data about size and space used for all the files in the current database with this script. ...


Database file growth settings

Database file growth settings


Script to change auto growth settings for all databases in SQL Server

Script to change auto growth settings for all databases in SQL Server.