Thursday, 23 June 2016

T-SQL Script for Shrink Log file in SQL Server

Here is the useful T-SQL Script for shrink database log file.

USE [DatabaseName];
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [DatabaseName]
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (DatabaseName_log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE [DatabaseName]
SET RECOVERY FULL;

GO
Visit Our New Site for HR Interview Questions Answers http://www.interviewboat.com/Company/GetCompany
Sponsored Ads

1 comment:

  1. Truly a very good article on how to handle the future technology. After reading your post,thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic.


    SEO Company in Chennai

    ReplyDelete