SQL Query: Force to 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

 

 


Skip to main content