Here’s a T-SQL to send automated email alerts.

whenever a SQL Server Monitoring Transaction Log size exceeds a specified threshold.

The above T-SQL is very simple. The T-Log size across all database is inserted into a temp table by executing DBCC SQLPERF(LOGSPACE).

The temp table is then queried to get all databases with T-Log greater than the specified threshold (@threshold parameter).

The result set is wrapped into a html table format and is sent to specified address. The mail is sent using database mail stored procedures.

A snapshot of how email looks like is shown below.


Schedule it as sql job per your convinient schedule to keep an eye on T-Log size.



Ahmad Osama

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook