|
If my log fills up, what is the best way to clear it in SQL Server 2000? What about in SQL Server 2005?
(comments are locked)
|
|
Step 1 - back it up!
(comments are locked)
|
|
Have you found the cause of why the log is filling up ? Microsoft have some good info Here That link only applies to versions 4.21a, 6.0 and 6.5
Nov 12 '09 at 01:02 PM
Kev Riley ♦♦
Apologies. Here is a more upto date link
Nov 12 '09 at 01:21 PM
dave ballantyne
I like the title of that second one. If the computer wasn't running SQL Server and the transaction log grew, then that would be unexpected!
Nov 12 '09 at 01:32 PM
Matt Whitfield ♦♦
(comments are locked)
|
|
Don't think I can help with 2000, but I have a couple notes from shrinking a 2005 log. I assume you're using a Recovery model of 'Full' for your database (in SSMS: right click on db -> properties -> Options). The log will not empty out until you back it up. Most times you can do this by doing a FULL backup of you database, which marks the spot in the log where you have backed up. The database won't allow you to clear anything out of the log until it sees the log file has been backed up. Any time I've had problems with a full log, I've had to run a couple FULL backups to properly mark the log file for shrinking. This involves working with SQLPERF and LOGINFO to make sure the log is setup correctly before doing the SHRINKFILE. This link should help: http://www.mssqltips.com/tip.asp?tip=1225 A FULL backup will not allow used log space to be reused or shrunk. Only a LOG backup will mark the log space for reuse and allow SHRINKFILE to release that space back to the OS. If you shrink then make sure you allow enough space so that the log doesn't need to grow again.
Nov 13 '09 at 08:00 AM
David 1
(comments are locked)
|
|
The nuclear option:
This pretends to do a backup and throws away all existing transaction logs, and then it shrinks the logfile. This is not without danger as you cannot do a point-in-time restore after truncating the logfile. The logical logfile name can be found in the properties of the database, Files tab, and then Logical Name. I don't think I should shrink it first. What does this do?
Nov 12 '09 at 02:23 PM
Steve Jones - Editor ♦♦
It forces the database to discard the transaction logs, basically something you'd use if the harddisk was 100% full and nothing else worked. If you can still back up, that's by all means the best option :)
Nov 12 '09 at 08:51 PM
Andomar
Note that the TRUNCATE_ONLY option was deprecated in 2005 and removed altogether in 2008. Set the Simple Recovery mode instead, which does much the same thing.
Nov 13 '09 at 07:56 AM
David 1
(comments are locked)
|

