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

<<  March 2024  >>
MoTuWeThFrSaSu
26272829123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar