次の方法で共有


Removing Orphan sites from SharePoint 2007

I am sure you have seen enough blog posts on this and so I thought will add one more to the ever growing list!!

So for last few days I have been working with one my my colleagues to install and Configure Enterprise Portal (AX 2009) with SharePoint 2007 Farm (1 WFE + 1 App Server connecting to SQL) – it’s a different war altogether but let me tell you how we landed up with multiple orphan site collections. EP was failing to install every time (and we did this at least 10 times) since it could not create the site collation with the Custom Site Definition. we finally got around it, but in the process EP installer was invoking a web service to create the namespace every time >> https://<sharepointSiteDNSName>/sites/DynamicsAX .

Finally when the EP installation completed successfully we could not browse the EP Role Center Site. after few hours of banging our head we finally went in SQL (ContentDB >> Site table) and saw a bunch of entries which shouldn’t be there >> Touching SQL Content Db in SharePoint is not supported – so don’t do it, I will tell you how to find orphan sites without touching SQL.

when you run stsadm –o databaserepair command – it shows the orphan items in a content DB .. however, our showed 0, reason being, there wasn’t anything in the content DB per say. so what to do??

Make sure you have SP2 for MOSS first.

There are primarily two ways to find this out.

  1. preupgradecheck – it not for upgrade only. it checks your MOSS health and lets you know what you should be doing. ideally you should run this on a scheduled manner to ensure MOSS is healthy. We ran stsadm –o preupgrade and it did tell us the bunch of orphan site collections

    image

    Below this it also notifies to run databaserepair and or detach / attach content DB – we did this but it didn’t resolve the issue and preupgradecheck continued to report the orphaned site collections

  2. enumallwebs – this was the savior !! this command runs against content DB and not on a URL context. We ran it and it displayed some 8 sites where the InSiteMap property was False. this denotes that the Site Collections are orphaned. See below:

    image

    The command is stsadm –o enumallwebs –databasename YourSQLName –databaseserver YourSQLServerName
    https://technet.microsoft.com/en-us/library/dd789634(office.12).aspx 

ok so we found the orphan addresses, now clean up time. Since attach / detach and databaserepair with deletecorruption switch didn’t help us, we decided to manually delete the Sites with SiteID. if you note above, EnumAllWebs shows the GUID of the Sites that we will use to delete them and clean up the WebApp

The command to run here is : (copy site ID from above output for all of them where InSiteMap=False) - https://technet.microsoft.com/en-us/library/cc288016(office.12).aspx 

stsadm -o deletesite -force -siteid 40ca628e-8d7c-461b-9340-c5bb518cf399
-databasename wss_content_ep -databaseserver sql08W2008X64

image

That did it!! to Verify, we ran preupgradecheck again and it didn’t report any Orphan Site Collections.

Hope this helps.

Cheers,
Priyo

Comments

  • Anonymous
    July 24, 2012
    The comment has been removed

  • Anonymous
    February 19, 2013
    Hi I have posted this question on Technet forum social.technet.microsoft.com/.../536f50c3-6bc3-4e9b-a823-4116c3445c41 have you any suggestion? thx

  • Anonymous
    February 19, 2013
    @Guiseppe its most certainly a orphan site, but I cannot confirm without looking into all the logs. can you actually browse the site? if not, it might just be an entry in the SiteMap table and you should be ok removing the entry