Tuesday, March 5, 2013

SQL Query: Shrink all DBs

DO NOT USE THIS SCRIPTS WITHIN YOUR PROD ENVIRONMENT!!!!

sp_MSForEachDB '
backup log [?] to disk = ''nul'''
go

sp_MSForEachDB '
use [?];
checkpoint
'
go


sp_MSForEachDB '
USE [?];
DBCC SHRINKFILE (N''?_log'' , 1024)
'
go


No comments:

Post a Comment