How to shrink SQL Server 2008 Database log

by zebsadiq 27. February 2014 00:04

Recently I discovered that a post that I wrote earlier about shrinking SQL Server log files is not valid for SQL Server 2008 onwards.

In particular, the tuncate_only command is no longer valid in SQL Server 2008.

Here is some code that you can use instead, however DO NOT USE THIS STATEMENT IN THE PRODUCTION ENVIRONMENT. This code should only be run in a low risk development environment for which a full backup is present:

USE [MyDatabase]
GO
ALTER DATABASE [MyDatabase] SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE(MyDatabase_Log, 1)
ALTER DATABASE [MyDatabase] SET RECOVERY FULL WITH NO_WAIT
GO

Tags:

SQL Server 2008

Comments

27/02/2014 00:13:26 #

How to shrink MS SQL Server 2005 Database Log

How to shrink MS SQL Server 2005 Database Log

Zeb Sadiq | Reply

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading



Calendar

<<  January 2019  >>
MoTuWeThFrSaSu
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar