Friday, September 17, 2010

Site Collection wont delete (orphaned record) - Sharepoint 2007

Scenario:  
- You created a managed path of /projectsites against the web app that is running your PWA Site
- you create the site collection for holding your Project Web Access Workspaces (so that you have your workspaces separated from your PWA Site)
- However this approach is changed at the last second, and you delete the managed path from the Central Admin configuration
- You then delete the site collection

result: Your Site Collection will not delete.  Attempting to enumsites against the web app will result in an error

reason:  the site has been orphaned in the content db

fix:

- Open your content db and select all from dbo.webs
- look fo the title of the Site Collection you created that you wish to delete in the Title field
- Copy the SiteID Guid
- in the 12/Bin folder of the app server, run:  

stsadm -o deletesite -force -siteid [enter the guid here] -databaseserver [database server name] -databasename -[name of your content database]

This will delete the orphaned records.

to confirm, run enumsites again on your web app to check all is well