While trying to restore a site collection with “Restore-SPSite” cmdlet in PowerShell, I got this error:
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.
Root cause and solution:
- If you try to backup – restore a site collection on the SAME content database, you’ll end up with this error.
Solution: Create a new content database and restore your backup to the specific content database.
Restore-SPSite https://intranet.crescent.com/sites/sales -Path D:\Backup\sales.bak -DatabaseServer SP13SQL -DatabaseName SP13_Sales_Content
- If you are trying to overwrite an existing site collection, use:
-forceparameter with Restore-SPSite or the
-overwriteparameter with stsadm -o restore
- You backup a site collection – Deleted the site collection – Trying to Restore the backup? Well, in SharePoint 2010 SP1 onwards, deleted site collections still live in the content database to be able to recover. Use: Get-SPDeletedSite to get the GUIDs of deleted site collections and completely remove the site collection from the database using: Remove-SPDeletedSite -Identity “SiteGuid”
- If you are trying to Delete and Re-Create a site collection, make sure it’s permanently deleted with “Remove-SPDeletedSite” cmdlet and Trigger “Gradual Site Delete” job from Central administration > Monitoring > Job definitions.