Pages

Friday, April 23, 2010

SQL Transaction logs

SQL transaction log can grow to large size (the one I encountered was 22 GB) and it took 15 minutes to restore the database from .bak file.

You can shrink the log by right clicking on the database in the enterprise manager and Shrink Files. I was using the dialog box but it was not working. I copied the script to the following error:
"Cannot shrink log file because all logical log files are in use" in the Messages

If you recieve error, follow these steps (by xangelx1985):
1. open enterprise manager.
2. right click on the database u wanna shrink it.
3. click on properties.
4. from the data properties go to options.
5. in the middle u will see recovery model make it "simple" then click on "ok" and try to shrink the database.

http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/ae4db890-c15e-44de-a2af-e85c04260331

I yet need to study this what caused the log to grow so big. I came across some MS articles blaming that if transactions are executed without rolling back or finishing the transaction log can grow big however I need to read it in depth.

No comments:

Post a Comment