June 23, 2010 at 1:58 pm
Hi All,
I have a very limited drive space on my server. And my database has enough unallocated space to be freed upon. My database is in simple recovery mode. Now, when I try to shrink the data (.mdf) file to minimum size, this operation basically fills up the log file and because of that my drive size start reducing. Cosidering if I can't change the recover model, what are the other options to avoid this from happening?
Thanks for the help...
June 23, 2010 at 2:06 pm
Not much more you can do. If you are in SIMPLE mode, you're truncating the log as fast as you can, and shrinking a database is a logged operation. You can't shrink the data without adding to the log. Can you move the log file to an alternate location if needed?
June 23, 2010 at 2:17 pm
Shrink it in small chunks.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 23, 2010 at 2:21 pm
Thanks both for the reply,
If I change the recovery model to bulk logged, and then shrink -- will it help?
June 23, 2010 at 2:25 pm
No -- DBCC ShrinkDatabase is not one of the minimally logged operations, so bulk logging won't help you.
Besides -- SIMPLE is going to be better for log space than bulk logged in almost every case I can think of.
June 23, 2010 at 2:28 pm
Okay, thanks for the reply. I would probably move the log file to some other location if possible.
June 23, 2010 at 2:37 pm
apat (6/23/2010)
If I change the recovery model to bulk logged, and then shrink -- will it help?
You're already in simple recovery, in simple recovery bulk operations are minimally logged and the log is automatically truncated on checkpoint. In bulk logged recovery bulk operations are minimally logged but the log is only truncated on a checkpoint.
Hence, if you change to bulk logged recovery, bulk logged operations (of which shrink is not) will still have the same log impact but now you'll have to take log backups for the space to be reused. Hence the log is more likely to grow, not less.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 23, 2010 at 2:39 pm
apat (6/23/2010)
Okay, thanks for the reply. I would probably move the log file to some other location if possible.
Good idea. Also see of you can get more space for the data file so that you don't have to shrink it. It's not a good thing to do regularly.
See - http://sqlinthewild.co.za/index.php/2007/09/08/shrinking-databases/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply