Click here to Skip to main content
15,881,424 members
Articles / Database Development / SQL Server
Tip/Trick

Clearing Transaction Logs

Rate me:
Please Sign up or sign in to vote.
4.78/5 (10 votes)
24 Jan 2011CPOL 26K   6   12
Clear the transaction Log if you are facing a low disk space
Clear the transaction Log if you are facing a low disk space on the database server.

To truncate log, use the following commands:

SQL
DBCC SHRINKFILE('logfilename', 1)
BACKUP LOG redeoba WITH TRUNCATE_ONLY DBCC SHRINKFILE('logfilename', 1)


where log filename is usually database name, i.e., northwind.log.

Please do let me know, if you have any doubt.

Please provide "Vote":thumbsup: if this would be helpful.:rose:
Thanks,
Imdadhusen

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Infostretch Ahmedabad-Gujarat
India India
Aspiring for a challenging carrier wherein I can learn, grow, expand and share my existing knowledge in meaningful and coherent way.

sunaSaRa Imdadhusen


AWARDS:

  1. 2nd Best Mobile Article of January 2015
  2. 3rd Best Web Dev Article of May 2014
  3. 2nd Best Asp.Net article of MAY 2011
  4. 1st Best Asp.Net article of SEP 2010


Read More Articles...

Comments and Discussions

 
GeneralMy vote of 5 Pin
Savalia Manoj M7-Nov-12 1:10
Savalia Manoj M7-Nov-12 1:10 
GeneralRe: My vote of 5 Pin
Sunasara Imdadhusen22-Apr-14 4:01
professionalSunasara Imdadhusen22-Apr-14 4:01 
GeneralMy vote of 4 Pin
Member 93931173-Oct-12 22:39
Member 93931173-Oct-12 22:39 
GeneralRe: My vote of 4 Pin
Sunasara Imdadhusen22-Apr-14 4:01
professionalSunasara Imdadhusen22-Apr-14 4:01 
GeneralReason for my vote of 4 Very useful in the database applicat... Pin
Pravin Patil, Mumbai24-Jan-11 3:29
Pravin Patil, Mumbai24-Jan-11 3:29 
GeneralRe: Reason for my vote of 4Very useful in the database applicat... Pin
Sunasara Imdadhusen22-Apr-14 4:02
professionalSunasara Imdadhusen22-Apr-14 4:02 
GeneralRemoved superfluous "Accept Answer" request (not available h... Pin
Indivara23-Jan-11 16:08
professionalIndivara23-Jan-11 16:08 
GeneralRe: Removed superfluous "Accept Answer" request (not available h... Pin
Sunasara Imdadhusen22-Apr-14 4:02
professionalSunasara Imdadhusen22-Apr-14 4:02 
GeneralReason for my vote of 2 Please explain more in-depth. Pin
Jerry OLoughlin6-Dec-10 17:34
Jerry OLoughlin6-Dec-10 17:34 
GeneralRe: Reason for my vote of 2Please explain more in-depth. Pin
Sunasara Imdadhusen22-Apr-14 4:03
professionalSunasara Imdadhusen22-Apr-14 4:03 
GeneralIt may also be helpful to point out that you can shrink the ... Pin
wizardzz2-Dec-10 6:04
wizardzz2-Dec-10 6:04 
GeneralRe: It may also be helpful to point out that you can shrink the ... Pin
Sunasara Imdadhusen22-Apr-14 4:03
professionalSunasara Imdadhusen22-Apr-14 4:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.