:-$

Ryan's work blog

My Links

News

The WeatherPixie
Subscribe with Bloglines
About this blog

Tools I use:

Post Categories

Article Categories

Archives

Image Galleries

Blog Stats

Personal

Projects

Random Blogs

Random other

Reference

Web comics

Work

Clearing a transaction log

Log files can sometimes get out of control and use up too much space.
This tends to be a problem when testing import scripts that do a lot of operations, then rollback, you can get crazy log file sizes. Here's how to clear them:
  1. Open up Query analyzer, connected as a user with admin priveleges.
  2. Run this query, substituting "db_name" with the proper database name:
    BACKUP LOG db_name WITH NO_LOG
    GO
    DBCC SHRINKDATABASE( db_name, 0)
    GO
  3. Check the size of the log file
Don't do this when the transaction log is important, though. Anyone know of a better way to do this?

posted on Thursday, September 09, 2004 4:25 PM