Resolving Restore-SPSite Errors occurring within Web Apps with Multiple Site Collections

Recently, a colleague requested that I perform a backup of a development site collection at and restore it to the test site collection

The test site collection was one of two site collections on the web app. It’s been a while since I’ve done anything in SharePoint, so I took a look then ran the following.

Backup-SPSite -Identity -Path \\fileshare\sp.bak
Restore-SPSite -Identity -DatabaseName WSS_Content_Test -path \\fileshare\sp.bak –Force -Confirm:$false

Admittedly, I was suspicious of the -DatabaseName param I was passing, because that database contained two site collections, and I was only attempting to restore one. Sure enough, the attempted restore gave me the following error:

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

Beware: This destroyed the /sites/sp site collection. Attempting to load it gave me a 404 Not Found. Honestly, I was a little blasé about the restore since it was to a test site. So I tried a few things to remedy the issue, and then figured that it would probably work if I isolated the site collection to its own database.

New-SPContentDatabase -Name WSS_Content_Test_SP -WebApplication
Move-SPSite -Identity -DestinationDatabase WSS_Content_Test_SP 
Restore-SPSite -Identity -DatabaseName WSS_Content_Test_SP -path \\fileshare\sp.bak –Force -Confirm:$false

And…done :)

Chrissy is a Cloud and Datacenter Management & Data Platform MVP who has worked in IT for over 20 years. She is the creator of the popular SQL PowerShell module dbatools, holds a master's degree in Systems Engineering and is coauthor of Learn dbatools in a Month of Lunches. Chrissy is certified in SQL Server, Linux, SharePoint and network security. You can follow her on Twitter at @cl.

Posted in SharePoint
One comment on “Resolving Restore-SPSite Errors occurring within Web Apps with Multiple Site Collections
  1. Chris says:

    I’m trying to restore to a new content database and still getting this error. It’s actually a generic error thrown by SharePoint. I’ve been struggling with it for 2 weeks and can’t get my life site restored on my local machine. I really hate SharePoint.

Leave a Reply