Omicron Llama

Coding all day, every day.

“Unexpected Error” whilst emptying Site Collection Recycle Bin

EDIT: Upon closer inspection of the DBCC CHECKDB output, running REPAIR_ALLOW_DATA_LOSS might not have actually been the fix. The restart of SQLServer service, or dropping the database into Single User then back to Multi may have done the trick. Try these two steps before doing the full DBCC.

As part of a project I’m working on, I’m flooding my development site with GBs of (sample) documents. This means the database fills quite quick and to restart my scenario I’m deleting the libraries and emptying the recycle bin.

At one point I had around 2GB of data across 3 libraries that were in the Site Collection Recycle Bin, and trying to delete permanently would just result in a “Unexpected Error”.

I then attempted to empty the recycle bin by traversing the items in PowerShell and removing them individually, but that would yield the following error when it attempted to remove the items:

A quick DBCC CHECKDB showed the fact that a couple of indices in the content database were indeed corrupt.

To fix, I simply ran DBCC CHECKDB using REPAIR_ALLOW_DATA_LOSS:

Then I re-ran my Powershell which returned instantly, and the recycle bin was clear!

As always, do a backup of your database before running this!

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *