May 9, 2019 Vignesh Sathiyanantham 0Comment

Changing the individual database recovery model is very simple with the Microsoft SSMS. But recently in one of our Nimesa customer environments, he had 200 databases in a non-production instance and all the databases are in the simple recovery model.

That user wanted to do POC of Nimesa Application-aware backup and Point in time recovery for MS SQL database server, Log backups are not possible with the simple recovery model, so I executed a small PowerShell script which changes all the databases to the FULL recovery model from the simple recovery model


Get-SqlDatabase -ServerInstance NW1\CLUST2

The above Powershell command gets all the databses on the Server instance

Then with a foreach loop, executed below query to change the database to the FULL recovery model

 ALTER DATABASE [$dbName] SET RECOVERY FULL WITH NO_WAIT 

Full script

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.