AppDynamics for Databases

2.9.x Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: TOCBox and headings
Appd tocbox

On this page:

Table of Contents
maxLevel2
minLevel2

Alert on SQL Server Database Size

Common metrics that DBAs and storage administrators want to track are how much space a database consumes at a given time and database consumption over time. These metrics can indicate when an individual database begins to consume excessive disk space and by analyzing these metrics you can also better forecast future storage requirements.

...

Code Block
titleSQL query for database disk consumption
SELECT 
      database_name = DB_NAME(database_id)
    , total_size_mb = CAST(SUM(size) * 8. / 1024 AS DECIMAL(8,2))
    , data_size_mb = CAST(SUM(CASE WHEN type_desc = 'ROWS' THEN size END) * 8. / 1024 AS DECIMAL(8,2))
    , log_size_mb = CAST(SUM(CASE WHEN type_desc = 'LOG' THEN size END) * 8. / 1024 AS DECIMAL(8,2))
FROM sys.master_files WITH(NOWAIT)
GROUP BY database_id

 

You can schedule this SQL to run as a custom alert that returns tabular data. For example,

  

The results of this Custom SQL Alert can trigger an email, if Alert Type is set to Information Only (trigger email) or if Alert Type is set to Normal

...

For example, the following shows that the first two columns of data are charted.


Custom SQL Alerts on the Web

The following is a collection of articles on the web for the Microsoft SQL Server platform which contain SQL that you may find useful for creating custom SQL alerts for your environment.  You can enter the SQL in the Custom Alerts SQL text box as described in Alert on Performance Metrics. 

Alert on IO Usage of SQL Data Files

Alert on Log Shipping Related Errors

Alert on Log Space Availability

Alert on Real Time Transactional Replication