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

2/27/2014 12:13:26 AM #

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

<<  December 2024  >>
MoTuWeThFrSaSu
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

View posts in large calendar