TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Shrink transaction log file in Sql Server
Manish Dwivedi
Jul 28, 2010
12.4
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
I am here mentioning very useful command for shrink the database log file.
Command are as follows:
For Sql Server 2005
BACKUP LOG
[DBNAME]
WITH TRUNCATE_ONLY
DBCC SHRINKFILE(
[DBNAME]
_log)
For Sql Server 2008
ALTER
DATABASE
[DBName]
SET
RECOVERY
SIMPLE
;
GO
-- Shrink the truncated log file to 1 MB.
DBCC
SHRINKFILE
(
DBName_log
,
1
);
GO
-- Reset the database recovery model.
ALTER
DATABASE
[DBName]
SET
RECOVERY
FULL
;
Shrink transaction log file in Sql Server
Next Recommended Reading
How To Shrink The Size Of A Transaction Log (.LDF) In SQL Using SQL Server Management Studio 2016