There is a strange issue in SharePoint 2013 environment today! One of the site collection provisioned via custom code is unreachable with "404 page not found" error. However, the particular site is listed under central administration >> View all Site collections! But no further details such as : Content database, etc. are available for the site collection in Central administration.
We concluded that the site collection is "Corrupted!". There are many scenarios where a site may go corrupted, such as: Storage media failure, Network connectivity issues, incorrect usage of PowerShell cmdlets (E.g. If you use Copy-SPSite without "DestinationDatabase" parameter, You'll end-up in corrupted site!), etc.
So, We tried deleting the site collection from SharePoint central admin, but SharePoint central administration didn't let me to select and delete the site. Tried STSADM -o DeleteSite and Remove-SPSite PowerShell cmdlet with no luck!
Stsadm and PowerShell ways resulted with an Error: <nativehr>0x80070003</nativehr><nativestack></nativestack>
Solution: How to Delete Corrupted Site Collections in SharePoint?We can delete corrupt site collections with either STSADM or with PowerShell in below methods.
STSADM to delete corrupt site collection:
Step 1: We need site ID, Database Server, Database name parameters of the site we need to delete. Run:
stsadm -o EnumAllWebs > SitesList.xml
This produces a XML file with details such as site collection ids, content database, database server, etc as below.
Step 2: Extract required parameter values and supply it to STSADM -o DeleteSite as:
stsadm -o deletesite -force -siteid "1252fd8f-a0ea-4ef9-9b66-4715f8e44b37" -databaseserver SP13-Ent-SQL01 -databasename SP13_Intranet_Content
stsadm -o deleteweb -force -webid <Web ID> -databasename <database name> -databaseserver <database server name>
Delete corrupt site collection with PowerShell:
Use this PowerShell script to delete a corrupted site collection in SharePoint.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $CorruptedSiteURL ="http://intranet.crescent.com/sites/sales" #Get the site collection $site = Get-SPSite $CorruptedSiteURL #Get the GUID of the site collection $siteGUID = $site.Id Write-host "Site collection GUID:"$siteGUID #Get the content Database of the Site collection $siteDatabase = $site.ContentDatabase #Force delete the site collection $siteDatabase.ForceDeleteSite($siteGUID, $false, $false)
You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.