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