Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to purge large .log files ?

Status
Not open for further replies.

dgillz

Instructor
Mar 2, 2001
10,038
US
How do I do this? We have log files that are approaching 4 GIG.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
Make a backup of the log files, this will truncate them. Set up a maintenance plan that backs up the transaction logs every day/week/month/whatever. For disaster recovery, you should be doing this anyway, at least once a day.



Hope This Helps!

Ecobb
Beer Consumption Analyst

"My work is a game, a very serious game." - M.C. Escher
 
Go into the database properties and change the Recovery Model to 'Simple' and run the following in quesry analyzer:

use database name
dbcc shrinkfile (TranLogFileName_Log ,0)
go

Change the Recovery Model back to the previous setting. This is a quick fix if your back up plan is not often enough. By all means, set up a plan to purge the file periodically. It can be every 5 minutes on an extremly busy application.
 
Are you doing any backups at all?

Before you do a log backup make sure you have done at least one FULL backup.

-SQLBill

Posting advice: FAQ481-4875
 
I've got a similar problem with a large transaction log - but my database is just a test development server.

There's no point backing this up as the data is of no use. I just want to reclaim disk space.

I tried deleting the log file in enterprise manager, but it said I couldn't delete the primary log file
 

You can't delete the log you need to shrink it.
Before you can shrink it you have to release entries. In a dev environment this usually means setting the recovery model to simple.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
gareth7
You can use the process in my post above. You may still want a backup process if the file continues to grow to fast.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top