Reducing the Database Log File Size

Hello All,

Today i’ll talk about how to reduce the file size of the Log file of your SQL Server Database.

Log Files tend to grow to an extent that it might eat up a lot of space on your drive and for me it went to an extent that my database was down due to lack of space on the drive.

So, no apps were able to dump any record into the database at all.

Well, we’ll have to live with it though as it seems.

Log Files can be cleared using a SQL Script

ALTER DATABASE  DATABASENAME
SET RECOVERY SIMPLE;
GO
— Shrink the truncated log file to 1 GB (You can shrink upto 1 MB).
DBCC SHRINKFILE (DATABASE_log, 1000); –LOG FILE NAME
GO
— Reset the database recovery model.
ALTER DATABASE DATABASENAME
SET RECOVERY FULL;
GO

Hope this works for you too!

Cheers!

Rohant K.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s