[Script Of May. 14] How to change the recovery mode for all the SQL Server user databases

image

May.

14

image

image

Script Download:   
The script is available for download from https://gallery.technet.microsoft.com//How-to-change-the-recovery-12db40a9.  You can also use  Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment.

This T-SQL script is used to change the recovery mode for all the SQL Server user databases. By creating a stored procedure, it will demonstrate how to generate the code of changing the recovery mode you don't need. If parameter provided, the script will output the following code:

1. Code of changing recovery model

2. Code of checking databases which are not in the recovery model you need.

As some people asked how to change recovery model for a batch of databases, we provide this script to offer some help by creating a stored procedure.

You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery