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 do I reduce log size?

Status
Not open for further replies.

Stuartp

Technical User
Feb 22, 2001
178
GB
The transaction log for one of our SQL Server databases is 4GB and I need to reduce it.

I've used the MS knowledge base and it says to run code "DBCC SHRINKFILE(pubs_log, 2), replacing this with my own log file name and size.

But it does not say HOW to run this, where to go to do it. Is this T-SQL?

I've spent ages searching on the web for how to run this but cannot find out. Does anyone know of an "idiot's guide" anywhere please I can go read, or can someone give me the steps I need to run this DDBC command?

Thanks
 
Yes it is SQL and you can run it in Query Analyzer. I would back up the log file first (if not in simple recovery mode) and then perform this command.
 
Do you do regular SQL backups? IF so, you should be able to re-index and shrink your files during the backup.
 
We backup through Veritas backup exec, although this particular database is not used now, it was set up as an experiment a couple of years ago.

I have run the command in query analyser and it has worked a treat - I now have half of the server C drive free!!

Many thanks for you help.#

Stuart
 
Maybe I should have said yoiu need to set up a Maintenance Plan for your db. This includes both optimizations and integrity checks. Set it up thru Enterprise Manager.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top