Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Unfortunately we had a situation where an IISRESET was performed by one user whilst another was creating a site collection - now the site collection can't be deleted.

When I go to central administration and try to select the site collection for deletion, it doesn't select at all. Additionally when I try to view the site collection it only shows the name - not the database or site collection administrator. The ULS logs don't show any errors either.

I tried to do a database repair with stsadm both with and without the deletecoppuption flag but that hasn't resolved the issue:

PS C:\Users\<redacted>> stsadm -url http://sharepoint/services -o databaserepair
-deletecorruption -databasename WSS_Content

<OrphanedObjects Count="0" />

I've also tried deleting the site using stsadm, but that doesn't work either.

PS C:\Users\<redacted>> stsadm -o deletesite -url http://sharepoint/services

<nativehr>0x80070003</nativehr><nativestack></nativestack>

Additionally when I try to enum sites to get the id of the collection so I can delete with the force flag, I get an error:

PS C:\Users\<redacted>> stsadm -o enumsites -url http://sharepoint/services
<Sites Count="3">   <Site Url="http://sharepoint" Id="0c18620b-11b4-4660-a65e-e75eb75a11c2" Owner="i:0#.w |<redacted>" SecondaryOwner="i:0#.w|<redacted>" ContentDatab ase="WSS_Content" StorageUsedMB="18.1" StorageWarningMB="0" StorageMaxMB="0"  />   <Site Url="http://sharepoint/projects" Id="1d517aa0-31bd-4a16-85b0-a32cb7d39aa7" Owne r="i:0#.w|<redacted>" SecondaryOwner="i:0#.w|<redacted>" ContentDatabase="WSS_Content" StorageUsedMB="1.9" StorageWarningMB="0" St orageMaxMB="0" />   **
<Site Error="&lt;nativehr&gt;0x80070003&lt;/nativehr&gt;&lt;nativestack&gt;&lt ;/nativestack&gt;" />**

Remove-spsite yields the following error:

PS C:\Users\<redacted>> remove-spsite http://sharepoint/services

Confirm
Are you sure you want to perform this action?
Performing operation "Remove-SPSite" on Target "http://sharepoint/services".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):y
remove-spsite : <nativehr>0x80070003</nativehr><nativestack></nativestack>
At line:1 char:1
+ remove-spsite http://sharepoint/services
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...mdletRemoveSite:
   SPCmdletRemoveSite) [Remove-SPSite], DirectoryNotFoundException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRemoveSi
   te

I've no idea how this can be resolved... Help!?

share|improve this question
2  
Have you tried Remove-SPSite -url "Your url"? I do not really understand why you are using stsadm in 2013, is there a particular reason? –  Robert Lindgren Oct 17 '13 at 13:31
1  
@RobertLindgren Tried that also, I've now included the results from that in an edit. This also shows an error. –  ElvisLikeBear Oct 17 '13 at 14:04

3 Answers 3

up vote 6 down vote accepted
SPContentDatabase.ForceDeleteSite 

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spcontentdatabase.forcedeletesite.aspx

use this method to force a delete:

SPWebApplication spWebApplication = SPWebApplication.Lookup(new Uri("http://mywebapplication")); // insert the webapplication

spWebApplication.ContentDatabases[0].ForceDeleteSite(new Guid("D0D529C1-DC06-4DB0-A8A3-81466E1E75DB"), true, false); // insert the ID from the errormessage

above is used for a console app

http://sharepointbox.blogspot.co.uk/2011_10_02_archive.html

and for a powershell script use:

$site = Get-SPSite http://siteurl

$siteId = $site.Id

$siteDatabase = $site.ContentDatabase 

$siteDatabase.ForceDeleteSite($siteId, $false, $false)

http://blog.claudiobrotto.com/2013/deleting-a-site-collection-that-cannot-be-deleted/

share|improve this answer
    
This did it, thank-you so much! –  ElvisLikeBear Oct 20 '13 at 23:48
    
no probs happy to help! –  ali Sharepoint Oct 21 '13 at 7:31
    
just solved my problem too! amazing powershell –  L.V. Sharepoint Architect Mar 7 at 11:28

What about getting the SpSite first and then deleting it?

$s = Get-SPSite "http://sharepoint/services"
$s.Delete()

Or if you cant get the site using that method you could iterate through the site collections in the web application...

$spWebApp = Get-SPWebApplication "url here"   
foreach($site in $spWebApp.Sites)
{
    #Logic Here to get the specific site...
}
share|improve this answer

Use powershell instead of stsadm to list all of your sites on the farm. In my experience some sites show up in Powershell and not in the user interface.

share|improve this answer
    
Please read the whole post; I've tried both –  ElvisLikeBear Oct 17 '13 at 14:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.