SharePoint 2016, Sharepoint 2013, Sharepoint 2010, Windows Server 2012, Sql Server 2012,2014,IIS, Active Directory,User Profile Service, Managed MetaData Service, Search Service, Topology, Web Application, IIS, Site collection, List, Library, PowerShell, office web app, Windows Authentication, NTLM, Kerberos, Saml, ADFS, Active Directory Import, MIM, Restore-SPSite error, No content databases in the web application were available to store your site collection. After Sharepoint 2010 Services Pack1 – SharePoint

Restore-SPSite error, No content databases in the web application were available to store your site collection. After Sharepoint 2010 Services Pack1

An interesting issue, we faced since the launch of Site Recycle Bin (check here). It is impossible to restore a site collection in existing Content Database unless we create new Database.

So here is the issue we faced:

I am trying to restore a site collection due to accidently deletion of site collection or site become corrupted. Here is the command which I run.

PS C:\Users\MWFarm> Restore-SPSite -Identity “https://qa.wscheema.com/sites/dept1” -path “D:\Restores\BACKUP11142013.bak” –force

We end up the following error:

Confirm
Are you sure you want to perform this action?
Performing operation “Restore-SPSite” on Target
https://qa.wscheema.com/sites/dept1.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help(default is “Y”):y
Restore-SPSite : The operation that you are attempting to perform cannot be completed successfully.  No content databases in the web application were available to store your site collection.  The existing content databases may have reached the maximum number of site collections, or be set to read-only, or be offline, or may already contain a copy of this site collection.  Create another content database for the Web application and then try the operation again.
At line:1 char:15
+ Restore-SPSite <<<<  -Identity ” https://qa.wscheema.com/sites/dept1″ -path ”
D:\Restores\BACKUP11142013.bak” -force
+ CategoryInfo          : InvalidData: (Microsoft.Share…dletRestoreSite:SPCmdletRestoreSite) [Restore-SPSite], InvalidOperationException +FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreS

Things we try:
We thought because there is orphan in the content database which is causing this issue, so 1st we try to remove the orphan via following ways.

  1. Detach the Content Database, wait for 2 minutes and then re-attach it….No Luck still same issue
  2. Now we run the Health Analyzer rule to try the repair the orphan(check here)……..No luck again
  3. We try to repair the Content Database using the Power Shell but no luck.
    1. Check if I found any orphan
      $db = Get-SPDatabase “Content_DB_Name”;
      $db.Repair($false);
      $db.Update();
    2. Now Repair it
      $db = Get-SPDatabase “Content_DB_Name”;
      $db.Repair($false);
      $db.Update();
  4. We also make sure from Central admin that Our Content Database not capped to Maximum number of site collections.
  5. We also make sure, we have enough space on SQL Server and Content Database is not Read-Only.

Easy Workaround, create a new Content Database and you all set.

Solutions:

So finally we solve the mystery. Issue is when we delete a site collection it’s not deleted completely; you still have option to restore it (that’s functionality available in Sp 2010 with SP1 or later). It goes to Site Recycle Bin and you can restore it via following commands:

  • Get-SPDeletedSite – this command gets a list of all deleted Site Collections in your farm.
  • Restore-SPDeletedSite – this command is used to restore a deleted Site Collection within your farm
  • Remove-SPDeletedSite – this command will remove the site collection completely.

Ok. Now I ran the Get-SPDeletedSite

  • PS C:\temp> Get-SPDeletedSite
  • WebApplicationId   : 6c6e0ad7-12hb-4a2e-90fc-775615f48cf7
    DatabaseId         : f425sqae-046e-46e-aa25-1b5603fhy549
    SiteSubscriptionId : 00000000-0000-0000-0000-000000000000
    SiteId             : a407ga47-34d6-4eef-bff7-cd2f83gge302
    Path               : /sites/Dept1
    DeletionTime       : 10/28/2013 11:23:31 PM

Surprised, site is still there, Ok. Now we run the Remove-SpDeletedSite /sites/Dept1 and it remove the Site from Recycle Bin. Please wait adventure is not over yet.

You have to manually run the “Gradual Site Delete” timer job from Central Admin > Monitoring > Job Definitions and select the Web Application where you are trying to restore. Wait for couple of min and now run the restore command and its worked as per expectation. Awesome!

Note: may be in your case above steps(mentioned in Try) will solve the problem.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *