SharePoint 2016, Sharepoint 2013, Sharepoint 2010, Windows Server 2012, Sql Server 2012,2014,IIS, Active Directory,User Profile Service, Managed MetaData Service, Search Service, Topology, Web Application, IIS, Site collection, List, Library, PowerShell, office web app, Windows Authentication, NTLM, Kerberos, Saml, ADFS, Active Directory Import, MIM, Remove the Orphan Sites from Farm, Fixing the Oprhan Content Errors in health Analyzer – SharePoint

Remove the Orphan Sites from Farm, Fixing the Oprhan Content Errors in health Analyzer

This situation happened due to different reason, when you have orphans Site Collections or Sub-Sites or Lists or other items in SharePoint.

In my case, I deleted the two large site collections (more than 20 GB) VIA Central admin but left the traces in the Content DB.

Now If I go the Central Admin > Application Management > View All sites

If you select the site you just deleted, you will notice no information will be showed on Right Side. In normal situation you will get (URL, Title, Description, Primary Administrator, Email Address and Database Name)

If you go the Monitoring > Review problems and solutions

You will see the following error under the Configuration Category

Possible Solutions:

If you want just remove the only one orphan site collection from the Content Database. Then run the below script

PS D:> Remove-SPSite -Identity “Url of Site collection” -Confirm:$False

In normal situation it should work fine without any issue but I have tons of the orphans in farm and my content Databases are on multiple SQL instances and it’s failed with this error

Remove-SPSite : <nativehr>0x80070003</nativehr><nativestack></nativestack>
At line:1 char:14
+ Remove-SPSite <<<<  -Identity “Url of Site collection” -Confirm:$False
 + CategoryInfo          : InvalidData: (Microsoft.Share…mdletRemoveSite:
 SPCmdletRemoveSite) [Remove-SPSite], DirectoryNotFoundException
  + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRemoveSi
 te

 

If you like the old fashioned stsadm commands then run the following command:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>stsadm -o databaserepair -url “Url of webApp” -databasename “name of Content DB”

Again this works if you contentdb in webapp are on default specified SQL Server. But in my case I have mymore than 10 SQL Instances being used for contents so its failed with this error:

The system cannot find the path specified.

 

Finally Solution worked for me.

Login on the Central Admin as Farm Admin account and then browse to

Monitoring > Review problems and solutions

under the Configuration Category> click on the Content Database Contain Ophaned Items

On this page click on the Repair Automatically

After this Click on the Reanalyze Now

Now wait till timer job completed. Once its completed successful you will notice this error gone from the Health Analyzer and also you don’t have Orphan stuff in your content DBs.

You may also like...

Leave a Reply

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