dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Test-DbaRecoveryModel

When you switch a database into FULL recovery model, it will behave like a SIMPLE recovery model until a full backup is taken in order to begin a log backup chain.

However, you may also desire to validate if a database is SIMPLE or BULK LOGGED on an instance.

Inspired by Paul Randal’s post on SQL Skills

Screenshots

dbatools-Test-DbaRecoveryModel

Examples

Shows all databases where the configured recovery model is FULL and indicates whether or not they are really in FULL recovery model.

Test-DbaRecoveryModel -SqlInstance sql2005

Only shows the databases that are functionally in SIMPLE mode.

Test-DbaRecoveryModel -SqlInstance . | Where-Object {$_.ActualRecoveryModel -ne “FULL”}

Shows all databases where the configured recovery model is BULK_LOGGED and sort them by server name descending.

Test-DbaRecoveryModel -SqlInstance sql2008 -RecoveryModel Bulk_Logged | Sort-Object Server -Descending

Shows all of the properties for the databases that have Full Recovery Model.

Test-DbaRecoveryModel -SqlInstance localhost | Select-Object -Property *

Author

This command was created by Claudio Silva. You can find Claudio on Twitter.

Get-Help

From PowerShell, execute Get-Help Test-DbaRecoveryModel -Detailed for more information on this function.

Source Code

Want to see the source code? View Test-DbaRecoveryModel.ps1 on GitHub
 

Related commands