Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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)

Another way to track the database data growth

By Max Yasnytsky,

Sometimes it is required to track growth of the data in the database. Google returned several ways of doing it but they all use msdb.dbo.backupset table. This approach is very good for historical analysis but may not work if you need to check the data growth daily over a short period. msdb.dbo.backupset records the size of the data file but not the actual size of data inside. Hence, even though the data is growing, size of the data file will be shown same until it will be full and grow again.

First script shows actual size of the data in the database, as well as size of allocated storage space. By default, script ignores other file types then ROWS; this can be changed by commenting out line 16.

Second script gives additional breakdown by filegroups.

Note to editor:

Steve,

This is second time I am posting script on your website and second time having the same issue. There is a problem running scripts after copying them from the web page because of the weird Unicode characters added instead of spaces. It is not visible until script is saved as ANSI text. I order to execute the script I need to save it as ANSI txt first, and then replace "?" symbols and only then script is "understood" correctly by SSMS. Can this be looked into please?

Thanks in advance.

Total article views: 3455 | Views in the last 30 days: 14
 
Related Articles
SCRIPT

Convert seconds to a timestring

This script converts a number of seconds (integer) to a time string, format 'hh:mm:ss'

ARTICLE

Second Normal Form

In this article Tom Thomson takes a look at what second normal form means, how it is violated, and h...

FORUM

bulk insert ignores every second linebreak

bulk insert ignores every second linebreak

FORUM

Select second highest wage

Select second highest wage

FORUM

Monitoring script

script

Tags
data growth    
database size    
monitoring    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones