SQL Recovery Mode
Hi,
How to make all MSSQL DBs run in Simple log form by default other than FULL so when we srhink DBs the logs will go bybye. :-)
Thanks
Hi,
How to make all MSSQL DBs run in Simple log form by default other than FULL so when we srhink DBs the logs will go bybye. :-)
Thanks
SET NOCOUNT OFF
DECLARE @strSQL nvarchar(50)
DECLARE @databaseName nvarchar (255)
DECLARE MyCursor CURSOR FOR --used for cursor allocation
Select name from sysdatabases
Open MyCursor
Fetch Next From MyCursor Into @databaseName
While @@Fetch_Status = 0
BEGIN
SET @strSQL = 'ALTER DATABASE '+ @databaseName + ' SET RECOVERY SIMPLE'
EXEC sp_executesql @strSQL
Fetch Next From MyCursor Into @databaseName
END
Close MyCursor
Deallocate MyCursor
Print 'Recovery Model changed to SIMPLE for all databases'
Hope this helps.
Thanks a lot. Can I please have script to set the recovery model simple for all new created db as default.
Thanks again.