Monday, February 11, 2013

Delete corrupted site collections in SharePoint

When I try to get a list of all the site collection in a SharePoint web application, the script throws an exception stating that it can’t find a specific site collection.

I went to the central administration to check if that site collection exist. It shows the site collection but all other information (e.g Content database, etc..) were empty. Since I don’t need the site I decided to delete that. But I couldn’t delete the site using central administration.

I tried to use the well known PowerShell cmdlet Delete-SPSite which throws a com error <nativehr>0x80070003</nativehr>

2

Following PowerShell script was successful in deleting the site

$site = Get-SPSite http://sp2013/sites/19014
$id = $site.Id
$contendDb = $site.ContentDatabase 
$contendDb.ForceDeleteSite($id, $false, $false)

You can get more information on ForceDeleteSite command from this Url

No comments: