Sunday, July 31, 2011

Find and Delete Orphaned Site Collections, Items in SharePoint

Orphaned Site Collection in SharePoint
Orphaned sites are broken sites created in situations like Restore interrupt/failure. During a migration project, I had to clean the SharePoint sites before migration as the preupgradecheck reported a huge list of orphaned sites.
remove Orphaned site collections in SharePoint

How to Delete Orphaned SharePoint Sites:
There are many ways to remove orphaned site collections in SharePoint. To remove orphaned site collections in SharePoint 2007 or in SharePoint 2010, use one of the following method:

 1.  Detach the content DB and attach again

 2.  To detect orphaned items, use the following command line:
stsadm -o databaserepair -url http://Web-App-URL -databasename <database Name>

To delete orphaned items, use the following command line:
stsadm -o databaserepair -url http://Web-App-URL -databasename <database Name> -deletecorruption

3. Do STSADM –o EnumAllWebs, note down the Orphan site id's, and then execute
    stsadm -o deletesite -force
   -siteid <site ID> (ID is listed in an output from enumallwebs)
   -databasename <database name>
   -databaseserver <database server name>

This will delete orphaned site collection in SharePoint.

4. PowerShell script to find and delete orphaned items in SharePoint:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$ContentDBColl = Get-SPContentDatabase

ForEach ($Database in $ContentDBColl)
   Write-Host "Detecting Orphans for " $Database.Name
In case, all the above fails, you can force delete site collection using PowerShell. Here is how: Force Delete Site Collections in SharePoint using PowerShell
Fix Orphaned Items in SharePoint 2013:
SharePoint 2013 comes with a health analyzer rule to detect and fix orphaned items. Head-on to SharePoint 2013 central administration >> Monitoring >> Click on "Review problems and solutions" under Health Analyzer >> pick "Content databases contain orphaned items." from the list.

Click on "Repair Automatically" to delete orphaned items.

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...