Send Email To DBAs When Transaction Log Sizes Reachs the Certain Limit

Sometimes the transaction log file may grow more than normal for some reasons. For example when the transaction logs are not backed up. In the following articles you can find articles about why the log file can be full or grows more than normal.

SQL Server Does Not Truncate the Transaction Log After Log Backup and Can Not Shrink the Transaction Log“,

Transaction Log is Full Due To a Reason(ACTIVE_TRANSACTION, LOG_BACKUP, REPLICATION)

If you know in advance that the log file is full and there is a problem, you can create a solution before it is too late. So we prepared the following script for our environment and wanted to share it with you.

Below you can find the script that send email transaction log file informations which log files are over 500 GB(You can change this value in the script if you want) in size and are too full to shrink.

You must configure database mail so that your SQL Server can send mail. The article “How To Configure Database Mail On SQL Server” can help you.

dbtut
Author: dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *