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

<<  July 2017  >>
MoTuWeThFrSaSu
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

View posts in large calendar