Skip to content

October 18, 2011

Reducing Database log size in SQL server

After a while, the size of the log files in MSSQL can grow astronomically and some maintenance will be required. Below is a quick SQL script to reduce file size by backing up the data and reducing the log files.

BACKUP LOG [DATABASENAME] WITH TRUNCATE_ONLY
USE [DATABASENAME]
GO
DBCC SHRINKFILE (‘DATABASENAME_log’ , 1)
GO

The above is very handy on a server with SharePoint installed as in a production environment, they can grow into many gigs of data.

Read more from Misc

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

*

This blog is monetized using Are-PayPal WP Plugin