Saturday, May 27, 2017

Restore-SPSite : The site collection could not be restored.

Error: "The site collection could not be restored. If this problem persists, please make sure the content databases are available and have sufficient free space"

Before doing anything we just need to check below points...

  1. We need to ensure that content database has enough space.
  2. Are we going to store SP Site on same Content DB
  3. Are we doing Restore first time.  



When we are trying to restore a SP Site over SharePoint Web Application ( On same Content DB ) where SP Sites already exists.  And to resolve this, please follow below steps :

Step 1: Create new Content database, We can create Content Database using below Power shell script


Clear-host;
add-pssnapin "Microsoft.SharePoint.powershell" -erroraction silentlycontinue

$User = "sa"
$PWord = ConvertTo-SecureString -String "Your Password" -AsPlainText -Force
$Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord

New-SPContentDatabase "WSS_Content_New" -DatabaseServer "DatabaseServerName" -WebApplication http://WepApplicationUrl/ 
 -DatabaseCredentials $Credential

OR We can just go to Central Administration → Application Management→ Manage content database → Click Add a content database








Step 2 :  Once the Content DB has been created, now restore SP Site in new Content DB, I have done through Power shell script.


Restore-SPSite http://WepApplicationUrl/sites/siteUrl  -Path C:\FilePath\BackupFileName.bak -Force 
-DatabaseServer "DatabaseServerName" -DatabaseName "WSS_Content_New"

That’s all we need to do when when site is already exists in Content Database. But if we re-storing
SP Site first time and still we are getting above error !! This is because SharePoint internally creates orphaned sites entry into Content DB and to resolve this issue there may be many solutions but I am following below,  we can use any below solution...

Solution 1: Run below Power shell script...

clear-host;
add-pssnapin 'microsoft.sharepoint.powershell' -erroraction silentlycontinue
$db = Get-SPDatabase "Your Content Database Name";
$db.Repair($true);
$db.Update();

Solution 2: We can use below STSADM command...

stsadm -o databaserepair -url "http://WebApplicationUrl" -databasename "Content DB Name" -deletecorruption



Thanks for reading this article and suggest if I am missing anything.


No comments:

Post a Comment

SharePoint Deployment Error : The specified path, file name, or both are too long.

Hi, Sometimes we get surprised with below error while deploying wsp file... Solution : To overcome with this issue, we just ne...