regarding orphan sharepoint site

Will 616 Reputation points
2020-10-10T17:10:31.087+00:00

Hi there,

Is there any way to delete a orphan site?? I try to many ways to delete orphan site by server code or PowerShell. It turns out the site is not orphan site and cannot be delete. I am realized that might be the information in database is corruption (data correlation is broken). so actually the site does not exists, but SharePoint always thinks that this website exists. Like this situation, does anyone have any idea on it??

Thanks

Microsoft 365 and Office | SharePoint Server | For business
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,126 Reputation points
    2020-10-12T02:40:10.337+00:00

    Hi @Will ,

    The information of orphan sites is stored in the configuration database > dbo.SiteMap table. You could delete the entry of orphan site from the dbo.SiteMap table.

    31474-image.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


2 additional answers

Sort by: Most helpful
  1. Sharath Kumar Aluri 3,071 Reputation points
    2020-10-10T20:21:53.983+00:00

    way back I had the similar issue, below script worked for me. If the script didn't work try clearing the config cache from the below script and try again this script.

    https://github.com/DwayneSelsig/spcachecleaner/blob/master/SPCacheCleaner.ps1

    Add-PSSnapin Microsoft.SharePoint.PowerShell
    $CorruptSites = "http://portal.sharepoint.com/sites/sharatha"
    
    Function DeleteCorruptSite
    {
    param($CorruptSite)
    Write-Host $CorruptSite : -foreground red
    $site = Get-SPSite $CorruptSite
    $siteId = $site.Id
    $siteDatabase = $site.ContentDatabase 
    $siteDatabase.ForceDeleteSite($siteId, $false, $false)
    Write-Host --Deleted from Content DB -foreground green
    }
    foreach ($CorruptSite in $CorruptSites)
    {
     DeleteCorruptSite $CorruptSite
    }
    

    Below articles for more troubleshooting steps:

    https://social.technet.microsoft.com/wiki/contents/articles/21968.sharepoint-deleting-orphan-sites.aspx
    https://www.sharepointdiary.com/2011/07/delete-orphaned-site-collections-in-sharepoint.html#:~:text=Head%2Don%20to%20SharePoint%202013,Automatically%22%20to%20delete%20orphaned%20items.

    Thanks & Regards,

    1 person found this answer helpful.
    0 comments No comments

  2. Frank van Eykelen 131 Reputation points
    2020-10-16T13:17:45.313+00:00

    Did you know that "orphan site" is an anagram of "sharepoint"? You're welcome.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.