Consider the following scenario. You have a content database that contains a site collection at a certain URL path. You want to attach that content database to a Web application. If the Web application already contains another site collection at the same URL path, the content database will be successfully attached. However, the site collection in that content database will be inaccessible. Therefore, you cannot delete it to reclaim space in your content database.
Multiple site collections in a Web application cannot share the same URL path. Therefore, SharePoint is aware of only the first site collection that is registered in the SharePoint site map. All other site collections that use the same URL path cannot be registered in the site map and are considered orphans.
The data in the orphaned site collection still exists, even though it is inaccessible. You can detach the content database from the current Web application and then attach it to another Web application that does not have a site collection registered at that URL path. The site collection will then be available.
Windows SharePoint Services 3.0 Service Pack 2 (SP2) provides new commands and parameters to locate orphaned site collections and sites and to delete them from your content database without having to use the workaround.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
953338 Description of Windows SharePoint Services 3.0 Service Pack 2 and of Windows SharePoint Services 3.0 Language Pack Service Pack 2
The stsadm -o enumallwebs command will list all site collections in a content database and whether they are registered in the SharePoint site map. The stsadm -o deletesite and stsadm -o deleteweb commands now support a -force parameter that lets you delete site collections and sites, based on their IDs, that are not registered in the SharePoint site map.
For more information about these commands, see the following articles in TechNet: