4 08 2014
“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:
1 2 3 4 5 6 7 8 9 10 11 12 |
Deleting FS: W . Delete : Exception calling "Delete" with "1" argument(s): "SQL Server detected a logical consistency- based I/O error: i ncorrect checksum (expected: 0xcef0af1a; actual: 0x2155712d). It occurred during a read of page (1:292113) in database ID 10 at offset 0x0000008ea22000 in file 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\SPS_Cont ent_SPDev.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database c onsistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books O nline." At C:\Users\Administrator\desktop\purgerycle.ps1:11 char:17 + $itemcoll.Delete <<<< ($id); + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException |
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:
1 2 3 4 5 6 7 8 9 10 11 12 |
USE master; GO ALTER DATABASE SPS_Content_SPDev SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DBCC CHeckDB(SPS_Content_SPDev, REPAIR_ALLOW_DATA_LOSS) ALTER DATABASE SPS_Content_SPDev SET MULTI_USER; GO |
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!
Freebie: Round-Robin SPServer Selector SharePoint 2013 “Cumulative” Updates Confusion