3 ways to delete orphaned sites

Here are three ways to remove orphaned site collections in SharePoint 2013, 2010. and 2007. To remove orphaned site collections in SharePoint 2007,  SharePoint 2010, or possibly in SharePoint 2013, use one of the applicable method:

 1.  Detach the content DB and attach again, all three editions.

 2.  To detect orphaned items, use the following command line ( 2007 and 2010):

stsadm -o databaserepair -url http://Web-App-URL -databasename <database Name>

 

To delete orphaned items, use the following command line:

stsadm -o databaserepair -url http://Web-App-URL -databasename <database Name> -deletecorruption

 

 KB: http://support.microsoft.com/kb/918744

3. Do

STSADM –o EnumAllWebs

 

, note down the Orphan site id’s, and then execute

stsadm -o deletesite -force  -siteid <site ID> (ID is listed in an output from enumallwebs)  -databasename <database name>  -databaseserver <database server name>

 

 

This will delete orphaned site collection in SharePoint.