locked
orphaned site collection in sharepoint RRS feed

  • Question

  • Hello,

    I'm planning to upgrate from MOSS 2007 to SP2010. We have more than 10,000 mysites on MOSS 2007. So I'm trying to get the list of the all the orphaned my sites that we have in our moss 2007 enviroment. I go a couple of way to do it.

    1. stsadm -o databaserepair

    It should detect the orphaned items in the content database and I believe it should just give me a count of orphaned items. correct?

    2. stsadm -o enumallwebs -databasename "xyz"

    and look for the proprty Insitemap - False

    So this command should give a list of all the site colection which is orphaned.

    Now question is, is there any other way which gives me a list of all the orphaned site colections?

    Please help.

    Thanks,


    Monday, August 8, 2011 9:22 PM

Answers

  • run stsadm -o preupgradecheck first to get list of orphan sites (if any) plus all other upgrade blocking issues. You will get db names where content or configuration site orphans exist and then you can use the above 2 methods to remove the, 

    For content db orphans - run stsadm -o databaserepair -deletecorruption to delete the orphans

    config db orphans -

    run ‘stsadm – o enumallwebs ‘list

    1.       Search sitemap=false

    Example : <Site Id="fdb79745-7ce5-4135-8a0d-d8ce10af40d6" OwnerLogin="xyz\owner" InSiteMap="False">

    2.       stsadm -o deletesite -siteid " fdb79745-7ce5-4135-8a0d-d8ce10af40d6" -databasename XXX -databaseserver "XXX" -force

     


    Amrita Talreja
    Monday, August 8, 2011 9:28 PM
  • The easy way to get the list of Orphan sites is running the pre-upgrade checker.

    to fix the issue other then Amrita Talreja's suggestion, you can simply detach and then re-attach that content DB which having the orphan will fix it.

    http://sharenotes.wordpress.com/2007/11/19/deleting-purging-removing-orphaned-sites-or-site-collections/

    Hope this help

    thanks

    -ws


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010)
    Monday, August 8, 2011 9:51 PM

All replies

  • run stsadm -o preupgradecheck first to get list of orphan sites (if any) plus all other upgrade blocking issues. You will get db names where content or configuration site orphans exist and then you can use the above 2 methods to remove the, 

    For content db orphans - run stsadm -o databaserepair -deletecorruption to delete the orphans

    config db orphans -

    run ‘stsadm – o enumallwebs ‘list

    1.       Search sitemap=false

    Example : <Site Id="fdb79745-7ce5-4135-8a0d-d8ce10af40d6" OwnerLogin="xyz\owner" InSiteMap="False">

    2.       stsadm -o deletesite -siteid " fdb79745-7ce5-4135-8a0d-d8ce10af40d6" -databasename XXX -databaseserver "XXX" -force

     


    Amrita Talreja
    Monday, August 8, 2011 9:28 PM
  • The easy way to get the list of Orphan sites is running the pre-upgrade checker.

    to fix the issue other then Amrita Talreja's suggestion, you can simply detach and then re-attach that content DB which having the orphan will fix it.

    http://sharenotes.wordpress.com/2007/11/19/deleting-purging-removing-orphaned-sites-or-site-collections/

    Hope this help

    thanks

    -ws


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010)
    Monday, August 8, 2011 9:51 PM
  • As "databaserepair" does work for any objects but orphaned sitecollections and although this question is quite old, I post my solution for others who are searching. Like I did, when the SharePoint Health Analyzer showed me some [SiteOrphan] entries.

    #remove any sitecollection that is not found in the sitemap
    $database = Get-SPContentDatabase -WebApplication "http://mywebapp"
    #or just $database = @{name="MyContentDatabaseName"}
    Foreach ($DBname in $database.name){
        #"stsadm -o enumallwebs" gives back an XML which we can parse for the orphaned sites
        [xml]$allwebs = stsadm -o enumallwebs -databasename $DBname 
        #filter those that are missing in the sitemap and pass them back to stsadm to delete
        $OrphanedSites = $allwebs.Databases.Database.site | ?{$_.insitemap -match "false"}
        Foreach($site in $OrphanedSites){
            Stsadm -o deletesite -force -siteid  $site.Id -databasename $DBname -databaseserver $allwebs.Databases.Database.datasource
        }
    }

    Cheers and good luck

    • Proposed as answer by radmantom Saturday, April 12, 2014 6:48 PM
    Saturday, April 12, 2014 6:47 PM