1

We have recently discovered following error in SharePoint Health Analyzer report page: "Content databases contain orphaned items."

We have identified the faulty content DB, database status of content db is listed as: "Database is up to date, but some sites are not completely upgraded."

I assume thats what health Analyzer is talking about, Now how do i find out what exactly is corrupted or orphaned in that content db, without making any changes in the actual db.

Although SharePoint Health Analyzer page advises us to use "repair automatically" option, i am not a big fan of that without knowing what exactly is orphaned. Thank You

3 Answers 3

1

There are many reason for orphan items get cerated in the Content DB.

  • A restore operation that was not completed can result in sites in a content database that are not referenced in the SharePoint configuration database.
  • If site provisioning process interupted this will also create orphan objects.
  • Some time a custom feature not completely removed from farm, also cause orphan in db. and so on.

Now to remove the orphan items from the db, we always use the MSFT approach to fix it by running Repair Automatically. It is secure and if something happen to DB then this operation will not put us out of support. If this production then schedule it after hours and make sure your backup done(always best practices).

Now for "Database is up to date, but some sites are not completely upgraded." You have to run the Upgrade-spcontentDatbase against that Db, which will fix the issue.

0

What patch level are your farm currently running on? There is a bug prior to the September 2014 CU which creates the error in the health analyzer without any specific reason more than it came after applying the the April 2014 CU.

If it is because you run on a earlier version then September 2014, "repair automatically" won't solve the problem.

I had the same problem, annoying but not harmful. The error got resolved after applying the CU.

SharePoint 2013 - September 2014 CU

On the other hand, if you got a testing/staging environment that runs on the same patch level, you could always take a SQL backup and restore it to a testing environment and do some digging in the database there.

1
  • I am currently running SP1 in my Farm Jun 1, 2015 at 15:41
0

In some situations, a content database that is used by Microsoft SharePoint Foundation may become corrupted. The corrupted database may contain orphaned items. For example, a document may not have a parent document library or a list may not have a parent Microsoft SharePoint Foundation Web site. Consequently, you may be unable to create new items with the same URL as the orphaned items, and space in the content database will be consumed unnecessarily.

http://social.technet.microsoft.com/wiki/contents/articles/25559.sharepoint-health-analyzer-detected-an-error-content-databases-contain-orphaned-items.aspx

To fix this issue we need to remove these items from Content Database. Microsoft doesn't want users to make direct changes to Content Database. Hence I think its better to trust Microsoft and use Fix Now link.

https://technet.microsoft.com/en-in/library/ff805076(v=office.14).aspx

You can also try below script to find any orphaned items using PowerShell

if ((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) 
{Add-PSSnapin Microsoft.SharePoint.Powershell}

$CDBs = Get-SPContentDatabase
ForEach ($CDB in $CDBs)
{
    Write-Host "Detecting Orphans for " $CDB.Name
    $CDB.Repair($false)
}

http://blogs.technet.com/b/nishants/archive/2014/03/23/detect-content-db-orphans-in-a-sharepoint-2010-farm-thru-windows-powershell-updated.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.