0

We are running a series of Delete Queries to free up space on our SQL Server (2012) I was able to recover files after the "Recovery Error", but it is very time consuming.

So I keep the size of my deletes to about 1 million records, and this seemed to prevent triggering the "Recovery Pending".

Is there a better approach?

Thanks much

1
  • Do you have more data that you want in the table, or there is more to delete? tyr to export some data to another table and use truncate. Just my opinion
    – Racer SQL
    Nov 12, 2015 at 18:54

1 Answer 1

0

Use a loop to delete and make frequent transaction log backups while doing so. That way people can use the table and you will keep the transaction log at a responsible size

DECLARE @ROWCOUNT int = 1
  WHILE @ROWCOUNT > 0
BEGIN
 delete  top (10000)
  from [SomeTable]
  where [Something]
 set @rowcount = @@rowcount;
END;
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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