December 30, 2014 at 3:24 pm
Hello. In a SIMPLE recovery DB I tried to delete too many rows from a table at one time, leading to:
The transaction log for database is full due to 'ACTIVE_TRANSACTION'.
No problem, I'm on my dev machine and have since made some space on the tranlog drive. But DBCC Loginfo() is showing 97% of this log in use, so shrinking it won't do much.
How do I reclaim space in this log with these 'uncommitted' deletions pending? I suppose I could copy the good data off to another table and truncate the original. Presumably that will fee up the log. Or at worst stop and restart the SQL services.
Thanks,
Ken
December 31, 2014 at 1:29 am
You've got an active transaction. A session somewhere has run a BEGIN TRANSACTION and has not either committed or rolled the transaction back.
Commit or roll back the open transaction, then do your delete in batches (delete top (10000) ....)
No, copying the data and truncating the table would not clear the log, in fact the copying part would just fill it further.
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
December 31, 2014 at 7:14 am
I didn't start a transaction so there's nothing to roll back. Must have been one of those implicit transactions.
Anyhow, when I checked this morning everything had cleared out of the log. If I recall, Checkpoint comes along and does this. Maybe it was delayed yesterday.
Ken
January 2, 2015 at 9:44 am
And I don't know why you're looking at DBCC LogInfo() for this anyway.
Much easier is DBCC SQLPERF(LOGSPACE)
Watch my free SQL Server Tutorials at:
http://MidnightDBA.com
Blog Author of:
DBA Rant – http://www.MidnightDBA.com/DBARant
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply