ASP Developer Network - Brought to you by Steve Radich and BitShop, Inc. - http://www.bitshop.com

Menu [hide]

SqlTipsDBWontShrink

Database won't shrink, log file continually grows print
similar comment
You may run into a database that won't shrink, there's several "obvious" problems that are blogged about everywhere - However sometimes it's more complex.

First let me go over the basic things - Make sure all of these aren't your problem:
  • Log files will be kept until they are backed up in full recovery mode, this means a transaction log backup, NOT a full backup or database backup.
  • Log files should truncate at checkpoints if the database is in Simple recovery mode.

Now, assuming you fully understand the above things and your database STILL won't shrink there are some things you should know and check:

A view sys.databases contains a few fields:
  • Name - Name of database
  • log_reuse_wait - Reason why log isn't being truncated
  • log_reuse_wait_desc - Description

We can run the following query to get a status:

select name, log_reuse_wait, log_reuse_wait_desc from sys.databases where name = 'dbname'


You may receive a log_reuse_wait status of 6 - this means replication is behind. HOWEVER I was troubleshooting this today on a database without replication configured. Something is clearly wrong in the server setup to have this "confusion" in the database.

There's a Microsoft KB article that describes how to manually remove a publication / replication - The overly simple method is:

sp_removedbreplication '<Database name>'


References:


Created by: steveradich last modification: Tuesday 15 of September, 2009 [07:49:45 UTC] by steveradich



Search
in:
Our Sponsors
Server Colocation Specials
1u - $99/month
Dedicated From $49/mo
http://www.bitshop.com
ASPDeveloper.Net is part of
BitShop and hosted by BitShop
Need a Virtual Server 2005 Hosted Account? Why not trust ASPDeveloper's Team? We're a division of www.bitshop.com
ASP.Net 2.0 Developers Available - The exact same people that write here on this site:
http://www.bitshop.com
ASPDeveloper.Net is part of BitShop
Quality Business Internet Technology Shop - http://www.bitshop.com Sponsor of site and hosting
Read the blogs, request we set up one for you FREE
http://www.aspdeveloper.net
rss Wiki rss Blogs rss Articles rss Image galleries rss File galleries rss Forums rss Maps rss Directories
ASP Developer Network (since 1996) - Brought to you by Steve Radich and BitShop, Inc. - http://www.bitshop.com
Copyright © 1997-2005 by BitShop, Inc. All Rights Reserved.
No content may be reproduced in any form without written permission from BitShop, Inc.
We will be honored to assist with reproduction rights on our material if you contact us.
We also can provide print articles for your magazine, private training seminars at your site, and conference presentations.

Thank you for visiting. Please bookmark our site if you found it useful!
If you wish to make a donation it will help further the development of these free resources: