Created
April 22, 2020 07:14
-
-
Save tknaller/404dabd97c2cc8bc4a3ae776098f64b9 to your computer and use it in GitHub Desktop.
This file contains 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
USE MASTER | |
declare | |
@isql varchar(2000), | |
@dbname varchar(64) | |
declare c1 cursor for select name from master..sysdatabases where name not in ('master','model','msdb','tempdb') | |
open c1 | |
fetch next from c1 into @dbname | |
While @@fetch_status <> -1 | |
begin | |
select @isql = 'ALTER DATABASE @dbname SET AUTO_CLOSE OFF' | |
select @isql = replace(@isql,'@dbname',@dbname) | |
print @isql | |
exec(@isql) | |
select @isql = 'ALTER DATABASE @dbname SET RECOVERY SIMPLE' | |
select @isql = replace(@isql,'@dbname',@dbname) | |
print @isql | |
exec(@isql) | |
select @isql='USE @dbname checkpoint' | |
select @isql = replace(@isql,'@dbname',@dbname) | |
print @isql | |
exec(@isql) | |
fetch next from c1 into @dbname | |
end | |
close c1 | |
deallocate c1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment