7

Possible Duplicate:
Why Does the Transaction Log Keep Growing or Run Out of Space?

My .ldf file size keeps increasing. I already tried to shrink it but after that it just grows again. How can I permanently limit the filesize or perhaps even disable it entirely (since I don't think I'll ever use it).

0

2 Answers 2

12

You cannot disable/remove the LDF file. It has to exist, as it stores database transactions. What you can do is:

  1. Set the database recovery model to Simple

This should keep your LDF file from growing, and is set via the Options page of the Database Properties dialog.

For additional reducing, which I don't think is necessary, you can:

2 Set Auto Shrink to True

This is also done from the Options page of the Database Properties dialog:

enter image description here

3 Turn auto-grow off

This is done from the Files page of the Database Properties dialog:

enter image description here

Be aware that when a database is in the Simple recovery model, you will not be able to recover to a point in time

Or

  1. Set the database recovery model to Full (I guess it's already set this way)
  2. Create a full database backup
  3. Start creating transaction log backups regularly. It's best to schedule a SQL Server job to do this

The latter scenario provides better disaster recovery as it enables recovery to a point in time It's up to you to decide how much data you can afford to lose

4
  • 1
    What if I set the recovery model to Full (wasnt this way now), and set the Auto Shrink to true? Daily backups of the DB are already in place. Wouldn't that result in a non-growing ldf log without risk of losing more than 1 day of data?
    – Adam
    Commented Jan 14, 2013 at 13:12
  • 1
    @Florian Yes, daily database backups will provide losing maximum 24 hours of data. For the scenario you described, you don't need the Full recovery model and auto-shrinking. Having a database in Simple recovery and daily full database backups should be enough. Full recovery model is used only for a point in time recovery, and auto-shrink might cause performance problems: support.microsoft.com/kb/315512 Commented Jan 14, 2013 at 15:00
  • 5
    No, please do not ever set auto shrink to true for any file in SQL Server. Commented Jan 15, 2013 at 22:44
  • I was about to post this link here before seeing that @AaronBertrand had commented this itself. You could check Paul Randal's article on the topic as well.
    – Jaime
    Commented Sep 30, 2013 at 11:10
-1

You can take a look at the answers I received and posted in this thread: SQL Server virtual log size

I'm not sure if it's possible to disable the log completely, but the way I solved it has kept the logs from growing out of control.

Not the answer you're looking for? Browse other questions tagged or ask your own question.