Transaction log size check


Job details

Name: Transaction log size check
Platform: Sqlserver
Category: Capacity
Description: This procedure checks the size of the transaction log (log file(s) size), and compares it to the database size (data file(s) size). If the size of the transaction log file(s) in percentage is greater than the warning/alarm parameter value, the check returns a warning/alarm.
Long description: This procedure checks the size of the transaction log (log file(s) size), and compares it to the database size (data file(s) size). If the size of the transaction log file(s) in percentage is greater than the warning/alarm parameter value, the check returns a warning/alarm.
Version: 2.0
Default schedule: 10 5,17 * *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘sqlserver’]/instance[maj_version = ‘2000′ & hasengine=‘YES’ & eng_inst_priv = 0 & (engine_edition = ‘Microsoft SQL Server’ engine_edition = ‘Azure SQL Managed Instance’)]

Parameters

Name Default value Description
min transaction log size 2500 The minimum size (in MB) of the transaction log files that will be examined.
warning threshold 100 The threshold (in percent) to trigger a warning. If the size of the transaction log file is greater than f.ex. 100% (the default value of the parameter) of the total size of the data file(s), the check returns a warning.
alarm threshold 200 The threshold (in percent) to trigger an alarm. If the size of the transaction log file is greater than f.ex. 200% (the default value of the parameter) of the total size of the data file(s), the check returns an alarm.
ignore offline databases NO If set to YES, the check will ignore databases which are offline.
ignore databases The list of databases to ignore (separated by comma).
change status when not full 95 If the transaction log file is not full (default value – 95% full) the alert will only trigger a warning.

Job Summary

SELECT name, size, max_size FROM sys.master_files WHERE type_desc = 'LOG'

Implementation Details

The job involves:

Database Criteria

The job targets:

Code Snippets

This job utilizes the following SQL procedures and tables:

CREATE TABLE dbw_trans_log_check_table (…)
CREATE PROCEDURE dbw_trans_log_check @taskID INT AS BEGIN … END

Dependencies

Dependencies include:

Alarm Configuration

The job uses parameters such as:

Reporting

The job provides a report which includes:

Data Column Description
Database Names of the databases checked
Data size Size of the data files
Data file count Number of data files
Log size Size of the log files
Log file count Number of log files
Ratio Ratio of log size to data size in percentage
Status Current status based on thresholds
DB Status Status of the database like online or offline
Log space used Percentage of log space used

This output format ensures that administrators have a clear and organized view of the transaction log sizes relative to their databases, making it straightforward to identify potential issues.