Search SupportSQL
Main | “Security management” series – audit all granted protects – all databases »
Sunday
10May2009

Shrink All Database Log Files at Once

Use this batch to quickly shrink all database log files, freeing up any space at the end of the file. To shrink even more, first complete a full database backup, then run this:

DECLARE @cmd nvarchar(max)

SET @cmd = ‘use [?]; DBCC SHRINKFILE (2, TRUNCATEONLY);’

EXEC sys.sp_MSforeachdb @command1 = @cmd

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.
Member Account Required
You must have a member account on this website in order to post comments. Log in to your account to enable posting.