19 February 2013

Successfully Shrink Database Log File (*.ldf) in SQL 2005

This may also work in other versions of SQL, but I've not tested it.

First, back the database up. I'm assuming you can figure out the details of backing up. I normally backup to disk and create a new file for the backup in a set backup location/drive/disk.


Then, set the database to use simple backup mode, as seen in the drop-down list in the image below.


Finally, shrink the database, ensuring you select the Reorganize files... option. Select a minimum freespace of anywhere from 0 to 20. If it is low, you are likely to see some instant growth in your database. If it is too high, you're wasting space.




No comments:

Post a Comment