Check database recovery mode


Job details

Name: Check database recovery mode
Platform: Sqlserver
Category: Availability
Description: Checks if all databases are running in FULL or SIMPLE recovery mode.
Long description: Checks if all databases are running in FULL or SIMPLE recovery mode. This procedure can be configured to change the recovery mode for a database to a value defined by the configuration parameter ‘allow recovery mode’ (and then switch back to status OK). Only ONLINE databases are checked.
Version: 1.61
Default schedule: 5 5,19 * *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘sqlserver’]/instance[maj_version > ‘2000′ & hasengine=‘YES’ & (engine_edition = ‘Microsoft SQL Server’ engine_edition = ‘Azure SQL Managed Instance’)]

Parameters

Name Default value Description
ignore databases model,msdb,master,tempdb,dbwatch List of databases (separated by comma) which will be ignored from being checked (% sign can be used).
allow recovery mode FULL Returns warning if the database is not in the mode defined by this parameter.
change recovery mode NO If set to “YES“, the dbWatch alert will change the recovery mode for the database to the value defined by the configuration parameter “allow recovery mode”, and then switch back to status OK.

Job Summary

SELECT name, recovery_model_desc FROM sys.databases WHERE name NOT IN ('model', 'msdb', 'master', 'tempdb', 'dbwatch');

Implementation Details

This job:

Parameters Overview

Dependencies and Operations

The key procedure “dbw_db_recovery_mode” and its associated history table “dbw_db_recovery_mode_histr” are crucial for the execution and logging of this task. Their operations involve:

Scheduling

This job is scheduled to run at specific times twice daily, as indicated by the setting “5 5,19 * *”, ensuring regularly updated checks and adjustments if required.

Technical Implementation

The underlying SQL scripts involve:

Reporting

The system generates reports indicating any changes made, current settings, and non-compliance instances. These reports help in auditing and tracking the consistency of database configurations against set recovery standards. Each entry in the report captures details such as database name, ID, the status before and after changes, and the exact timing of alterations.

Upgrades and Adjustments

Updates to this job involve modifications in the SQL implementation scripts to accommodate changes in database engine features or enhancements in dbWatch functionality. These changes ensure that the job remains compatible with new SQL Server or Azure Managed Instance versions, reflecting advancements in technology or changes in compliance demands.