stsadm databaserepair not deleting orphans
WSS 3.0 x64 SP1. Two SharePoint servers in the Farm. SQL Server 2005 x64 SP3We recently migrated a site collection via stsadm backup and restore. Unfortunately our SQL log file drive filled up and the restore failed - but not before some content was created. The log volume has plenty of capacity now but we need to address the orphansCentral admin shows the site collection, but we aren't able to delete it there or from stsadm. When I run the command:stsadm -o databaserepair -url https://site -databasename ContentDBIt lists:<OrphanedObjects Count="2"> <Orphan Type="SPList" Id="{E38DD671-802D-468D-99ED-990787D575EA}" SiteId="{4099C488-40A7-47E9-BB58-AEFA948A594C}" /> <Orphan Type="SPList" Id="{AFE3F3AD-7BC8-4045-8A41-9EC2C5427198}" SiteId="{4099C488-40A7-47E9-BB58-AEFA948A594C}" /></OrphanedObjects>I have run the command with the -deletecorruption option and receive:<OrphanedObjects Count="2"> <Orphan Type="SPList" Id="{E38DD671-802D-468D-99ED-990787D575EA}" SiteId="{4099C488-40A7-47E9-BB58-AEFA948A594C}" Deleted="Yes" /> <Orphan Type="SPList" Id="{AFE3F3AD-7BC8-4045-8A41-9EC2C5427198}" SiteId="{4099C488-40A7-47E9-BB58-AEFA948A594C}" Deleted="Yes" /></OrphanedObjects>But running:stsadm -o databaserepair -url https://site -databasename ContentDBstill shows these two SPList items. I have run with the deletecorruption flag several times. I have waited 48 hours in case some internal timer needed to run to actually clean these up. The Orphan items still show up.Since we are on SP1 for SharePoint, I don't have access to some of the stsadm improvements that address orphans. I believe that disconnecting and reconnecting the Content DB on the farm will remove the Site Collection from Central Admin (i.e. the Config database), but I need a way to clean the orphans out of the Content DB.I have considered migrating the other site collections out of the Content DB in question, then simply deleteing the Content DB. I don't consider this an option and would like to fix the Content DB as is.Does anyone know of a different way to remove orphans in a supported way? I.e. NOT running SQL against the Content DB since that isn't supported.
March 1st, 2010 8:16pm
Hi DanHawk,
First, I would like to suggest you to install SP2 and run configuration wizard. Please note that stsadm databaserepair command only detects Content DB orphans and not Configuration DB. In order to troubleshoot the problem, database query is necessary. If you don’t want to make it in an unsupported situation, you can try the following steps:
1. Detach the database in question from SharePoint. This can be done from CA. Choose the proper web app, click the database, check the box to remove it and click OK.
2. Attach the database back into the web application. This would be easiest with stsadm –o addcontentdb command.
For more information, please refer to:
http://blogs.technet.com/corybu/archive/2007/05/31/sharepoint-orphans-explained.aspx
Hope this helps.
Lu Zou
Free Windows Admin Tool Kit Click here and download it now
March 3rd, 2010 11:42am
Lu Zou,Thank you for the reply. First of all, I am preparing to install SP2 but I must have orphans deleted before I can install SP2 - otherwise I would take care of this after SP2 with the new commands.According to: http://technet.microsoft.com/en-us/library/cc288269.aspx"If there are orphaned objects in the content databases — orphans are items that do not have any parent or child relationships — the software update installation fails."
If I follow your steps 1 and 2 above, that will clean out the Config DB but I need a way to delete the orphans from the Content DB.I have read the article you linked. In my original post I listed the two orphans that my system has. Both are SPList items but they reference a SiteId. It doesn't show a SPSite orphan object but this is likely because an entry still exists in the Config DB. But if this is the case, why are these SPList objects orphaned?I have tried to delete the site collection entry but it fails. This weekend I will detach and reattach the Content DB and see if that will remap a valid SPSite that I can delete. I'll post the results here.
March 3rd, 2010 5:43pm
As promised, I am updating the results from this weekends detach and reattach of the Content DB. Unfortunately nothing has improved. I still see the orphans as listed above, attempts to delete with the -deletecorruption flag still do nothing, and I still cannot delete the site collection that these orphaned items are tied to.One difference is that an enumsites used to display:
<Site Error="There is no Web named "/sites/site_name"." />
and after disconnecting and reconnecting the Content DB now displays:
<Site Error="List does not exist

The page you selected contains a list that does not exist. It may have been deleted by another user." />
Any additional thoughts on how to clean out these orphans?
Free Windows Admin Tool Kit Click here and download it now
March 8th, 2010 5:14pm
Hi Dan,
You could run the STSADM Enumallwebs command. The command is run against an entire database, and should provide further information on the site that hosts the SPList items, see:
http://technet.microsoft.com/en-us/library/dd789634(office.12).aspx
Look for the site containing the orphaned SPList items in the command output, if the site has an InSitemap='False' parameter then it is orphaned. Use the STSADM Deletesite command to remove the site:
By the way, you already have the site ID for the orphaned SPList items as stated in your original post above, you will need to use this SiteId in the STSADM Deletesite command:
SiteId="{4099C488-40A7-47E9-BB58-AEFA948A594C}"
Finally, run enumallwebs again to confirm deletion.
Hope this helps.
May 25th, 2010 11:34pm