Created
May 9, 2019 07:39
-
-
Save asvignesh/8deeed60e04cc62dfc5ab514a8bcd4eb to your computer and use it in GitHub Desktop.
Powershell Script to change the recovery model of the databases to FULL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dbs = Get-SqlDatabase -ServerInstance NW1\CLUST2 | |
foreach ($database in $dbs | where { $_.IsSystemObject -eq $False }) | |
{ | |
$dbName = $database.Name | |
$sql = @" | |
USE [master] | |
GO | |
ALTER DATABASE [$dbName] SET RECOVERY FULL WITH NO_WAIT | |
GO | |
"@ | |
invoke-sqlcmd $sql -ServerInstance NW1\CLUST2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment