locked
Sharepoint 2013 health analyzer is showing the following availability problem "Content databases contain orphans items" RRS feed

  • Question

  • I am working on SharePoint server 2013 enterprise , and i run the Health Analyzer, but i got this error "Content databases contain orphans items" :-

    Here is the full description of the problem when i click on the above error:-

    Title 
     Content databases contain orphaned items.  
    
    Severity 
     1 - Error  
    
    Category 
     Availability  
    
    Explanation 
     
    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.
     
    
    Remedy 
     
    Enabling automatic repair for this rule will delete the orphaned items. For more information about this rule, see "http://go.microsoft.com/fwlink/?LinkID=142694".
     
    
    Failing Servers 
      
    
    Failing Services 
     
    SPTimerService (SPTimerV4) 

    so can anyone advice on these 2 questions:-

    1. how i can identify what are the orphans items inside the content database ?

    2. how i can remove these orphans items?

    Thanks

    EDIT ..

    i run the following command :-

    PS C:\Windows\system32> (Get-SPContentDatabaseWSS_Content_*******).Repair($false)

    and i get the following result

    <OrphanedObjects Count="15">
      <Orphan Type="RoleAssignments" Count="15" />
    </OrphanedObjects>

    so not sure what does RoleAssignments means , and how i can remove them?




    • Edited by johnjohn11 Monday, February 15, 2016 1:53 AM
    Saturday, February 13, 2016 3:43 AM

Answers

  • Hi johnjohn123,

    Per my research, there is no way to report the exact issue of “<Orphan Type="RoleAssignments" Count="15" />” in detail.

    Maybe you can try to use PowerShell commands mentioned above to find the orphaned users in SharePoint.

    A demo to find orphaned users in SharePoint using PowerShell for your reference:

    http://www.sharepointdiary.com/2013/07/find-and-delete-orphaned-users-in-sharepoint-using-powershell.html

    Best regards,

    Linda Zhang


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by Victoria Xia Friday, February 26, 2016 8:42 AM
    • Marked as answer by Victoria Xia Sunday, February 28, 2016 1:06 PM
    Wednesday, February 24, 2016 1:28 AM

All replies

  • HI,

    1 : the issue is solved with the September 2014 CU. It is not documented in the list of fixes, but testing the Health Analyzer rule applying the CU was succesfully

    2 : https://technet.microsoft.com/pt-br/library/ff805076.aspx

    3: (Get-SPContentDatabase <content database name>).Repair($false)


    Deepesh Yevle -MCP MCTS MCITP ITIL


    • Edited by Deepesh Yevle Saturday, February 13, 2016 7:07 AM edit
    Saturday, February 13, 2016 7:05 AM
  • HI,

    1 : the issue is solved with the September 2014 CU. It is not documented in the list of fixes, but testing the Health Analyzer rule applying the CU was succesfully

    2 : https://technet.microsoft.com/pt-br/library/ff805076.aspx

    3: (Get-SPContentDatabase <content database name>).Repair($false)


    Deepesh Yevle -MCP MCTS MCITP ITIL



    Thanks for the reply..but Now I am on October 2015 commutative update + i am using sharepoint server 2013,, so I already have September 2014 installed .. So maybe the problem is Somewhere else..
    • Edited by johnjohn11 Saturday, February 13, 2016 4:40 PM
    Saturday, February 13, 2016 12:33 PM
  • HI,

    stsadm -o databaserepair -url http://<URL_of_WindowsSharePointServices_Site> -databasename <name of database that contains the orphan item> 

    stsadm -o databaserepair -url http://<URL_of_WindowsSharePointServices_Site> -databasename <name of database that contains the orphan item that is to be deleted> -deletecorruption

    or

     foreach ($db in Get-SPContentDatabase) {$db.Name, $db.Repair($false)} powershell command 

    or

    $db = Get-SPDatabase | where {$_.Name -eq “ContentDatabaeName”}

    $db.RefreshSitesInConfigurationDatabase()

    or for delete site

    #permanently delete all deleted sites
     Get-SPdeletedSite | Remove-SPDeletedSite -confirm:$false

     http://sharepoint.microsoft.com/Blogs/fromthefield/Lists/Posts/Post.aspx?List=0ce77946-1e45-4b43-8c74-21963e64d4e1&ID=143&Web=5170eb8a-912d-4024-814a-81e94b9d34ce.



    Deepesh Yevle -MCP MCTS MCITP ITIL

    Saturday, February 13, 2016 7:59 PM
  • HI,

    stsadm -o databaserepair -url http://<URL_of_WindowsSharePointServices_Site> -databasename <name of database that contains the orphan item> 

    stsadm -o databaserepair -url http://<URL_of_WindowsSharePointServices_Site> -databasename <name of database that contains the orphan item that is to be deleted> -deletecorruption

    or

     foreach ($db in Get-SPContentDatabase) {$db.Name, $db.Repair($false)} powershell command 

    or

    $db = Get-SPDatabase | where {$_.Name -eq “ContentDatabaeName”}

    $db.RefreshSitesInConfigurationDatabase()

    or for delete site

    #permanently delete all deleted sites
     Get-SPdeletedSite | Remove-SPDeletedSite -confirm:$false

     http://sharepoint.microsoft.com/Blogs/fromthefield/Lists/Posts/Post.aspx?List=0ce77946-1e45-4b43-8c74-21963e64d4e1&ID=143&Web=5170eb8a-912d-4024-814a-81e94b9d34ce.



    Deepesh Yevle -MCP MCTS MCITP ITIL


    Can u advice on how and the order to use these scripts ?? I am not sure I understand ur reply.. Thanks
    Saturday, February 13, 2016 8:09 PM
  • Hi johnjohn123,

    Run the following commands in order to identify the orphaned items:

    stsadm -o databaserepair -url http://<URL_of_WindowsSharePointServices_Site> -databasename <name of database that contains the orphan item>

    Then we get the orphans such as :

    <OrphanedObjects Count="1">
    
      <Orphan Type="SecurityScope" SiteId="{4241A883-60B9-4AB3-BE02-F3818FEAA489}" Name="departments/BA01_R3107/Documents/Access Service Document Repository/1. Human Resources Folder" InRecycleBin="Yes" />
    
    </OrphanedObjects>

    And the “deletecorruption” method is used to delete corrupted site collections, Web sites, lists, and documents.

    An article about “deletecorruption” method for your reference:

    https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.administration.spcontentdatabase.repair.aspx?f=255&MSPPError=-2147217396

    Another way to only list information and not do any changes to the environment, you can run the following 2 lines PowerShell commands. It gives you the same output as stsadm –o databaserepair does.

    $dbs = get-spcontentdatabase DatabaseName
    
    $dbs.Repair($false)

    This 3rd line below, will repair the orphans.

    $dbs.Repair($true)

    For more details about how to detect and repair Content Database orphans items with PowerShell, you should refer:

    https://guidesharepoint.wordpress.com/2015/06/18/how-to-detect-and-repair-content-db-orphans-objects-with-powershell/

    Best Regards,

    Linda Zhang

    Monday, February 15, 2016 11:08 AM
  • @Linda thanks for the reply, i already mentioned on my question that i tried the following:-

    I run the following command :-
    PS C:\Windows\system32> (Get-SPContentDatabaseWSS_Content_*******).Repair($false)
    and i get the following result
    <OrphanedObjects Count="15">
      <Orphan Type="RoleAssignments" Count="15" />
    </OrphanedObjects>
    so not sure what does RoleAssignments means , and how i can remove them?
    Monday, February 15, 2016 11:07 PM
  • Hi johnjohn123,

    “RoleAssigments” defines the securable object role assignments for a user or group on the Web site, list, or list item. Maybe this orphan role assignments caused by you have deleted users or groups that are granted to this role assignment.

    You can use the PowerShell command mentioned in the following article to find the orphaned users in SharePoint. Then back up the database, delete the orphaned users.

    http://www.sharepointdiary.com/2013/07/find-and-delete-orphaned-users-in-sharepoint-using-powershell.html

    Another workaround, backup the database firstly, then run the following commands to repair it.

    $dbs = get-spcontentdatabase DatabaseName

    $dbs.Repair($true)

    Best Regards,

    Linda Zhang


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.


    Tuesday, February 16, 2016 3:34 AM
  • Hi johnjohn123,

    “RoleAssigments” defines the securable object role assignments for a user or group on the Web site, list, or list item. Maybe this orphan role assignments caused by you have deleted users or groups that are granted to this role assignment.

    You can use the PowerShell command mentioned in the following article to find the orphaned users in SharePoint. Then back up the database, delete the orphaned users.

    http://www.sharepointdiary.com/2013/07/find-and-delete-orphaned-users-in-sharepoint-using-powershell.html

    Another workaround, backup the database firstly, then run the following commands to repair it.

    $dbs = get-spcontentdatabase DatabaseName

    $dbs.Repair($true)

    Best Regards,

    Linda Zhang


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.


    @Linda

    now by theory $dbs.Repair($true) should fix any problem reported by $dbs.Repair($false),, but i want to perform this on live server.. and in SharePoint i need to be very caution on doing these types of operations,, what i am trying to understand if there is a way to know exactly what are the users or users groups which will be removed ?? as currently i only have this info

    <Orphan Type="RoleAssignments" Count="15" />

    and it is very general and what does count="15" represents !! do you have any idea?



    • Edited by johnjohn11 Tuesday, February 16, 2016 4:23 PM
    Tuesday, February 16, 2016 1:15 PM
  • Hi johnjohn123,

    Per my research, there is no way to report the exact issue of “<Orphan Type="RoleAssignments" Count="15" />” in detail.

    Maybe you can try to use PowerShell commands mentioned above to find the orphaned users in SharePoint.

    A demo to find orphaned users in SharePoint using PowerShell for your reference:

    http://www.sharepointdiary.com/2013/07/find-and-delete-orphaned-users-in-sharepoint-using-powershell.html

    Best regards,

    Linda Zhang


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by Victoria Xia Friday, February 26, 2016 8:42 AM
    • Marked as answer by Victoria Xia Sunday, February 28, 2016 1:06 PM
    Wednesday, February 24, 2016 1:28 AM