Tuesday, February 14, 2012

Sql Server Shrink Log file

 

For a business Intelligence application, we used a sql server 2008 database for consolidating data from different sources, since data was imported, we didn’t need backup facility, so the database was kept in Simple Logged Mode.

In this blog we will see how to shrink the log files for a simple logged database.

IMPORTANT : Use this only for Simple Logged Databases

Use [DatabaseToShrink]-- Replace this with your simple logged database

Declare @FileId Int
select @FileId = FILE_ID from sys.database_files Where type_desc = 'LOG'

DBCC ShrinkFile(@FileId, 1)

select * from sys.database_files

No comments:

Post a Comment