SQL Express Database Size Limit Notification

Posted on February 21st, 2011

Recently a customer needed to monitor MSSQL 2008 R2 Express database sizes and be notified when the size grew too large. It is quite easy to monitor SQL Express database size with Overseer Network Monitor’s Database monitoring capabilities.

As you may know, SQL Express 2008R2 is limited to 10GB databases. Older versions, such as SQL Express 2005 and 2008(R1) were limited to only 4GB. This customer needed to be notified when certain databases hit 80% of their allowed size, so they could run an archival process to keep the database size under the database size limit for SQL 2008 Express R2. To do this, we setup a DB Query resource like this for each database that needed monitoring:

We used this SQL query:

SELECT  (SUM(used_pages)*8192)/1024 FROM sys.allocation_units

This gets the size of the data+indexes in the current MSSQL Database. We then setup a simple scalar result evaluator to notify if this value exceeded 8,388,608(8GB). Now, whenever the database size grows large, the customer will receive Emails letting him know to run his archival process.