Thursday, February 23, 2012

Fixing orphaned sitesFixing orphaned sitesTuesday, July 05, 2011


Before upgrade to SharePoint 2010 you may see orphaned sites reported in your upgrade logs. 
Now, stsadm.exe -o databaserepair is supposed to help you fix these references and get rid of the orphaned sites.  The keyword here being "supposed to"......If that fails, you can always find and delete these sites manually. 

First, enumerate all sites for a particular content database: 

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN>stsa
dm.exe -o enumallwebs -databasename SharePoint_Home_Content >> C:\AllSites.txt

What we are looking for is  InSiteMap  flag set to NULL, indicating that the particular site in question has no parent site, and is therefore orphaned. This is the TechNet article article that  about it. 

Record the GUIDs of the orphaned sites, and delete them one by one, by running: 

stsadm -o deletesite -force -siteid < Orphaned Site Collection ID > -databasename

Then, run the following command to map the remaining copy to the site map:

stsadm –o refreshsitemap

Now, just run the preupgrade checker one more time, and as you see no orphaned sites tap yourself on the back  for job well done :). 



No comments:

Post a Comment