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 :)