Tuesday, 27 November 2012

Restoring a site collection from a backup

Recently I was doing migration of a site collection after verification from the client. I used Backup-SPSite command to backup the site collection.

Then I tried to restore a site collection from a backup to and it was giving below error:

I tried to restore the site collection to another web-application and it was successful. So I started looking the differences of configuration of both web-applications and I found the one web-application for which PowerShell was complaining, has got multiple databases attached to it.
so what I did to restore the site collection is that I created another Content Database called “WSS_Content_NewSiteCollection” and attached to desired web-application as shown below:

then executed the following command

Restore-SPSite -Path C:\temp\exportedSite\SiteBackup.bak –DatabaseServer <DBServerName> -DatabaseName WSS_Content_NewSiteCollection –Force

And this time PowerShell did not complain it and created my site collection.