Tuesday, October 15, 2013

Error while restoring a site collection in the same content database

I wanted 2 sites to be the exact same. So I was performing a backup of a site collection http://sharepoint.fahad.com/sites/siteA and was trying to restore it as http://sharepoint.fahad.com/sites/siteB .


Backup-SPSite -Identity "http://sharepoint.fahad.com/sites/siteA" -Path "C:\ Backups\siteA.bak” -force -verbose

Restore-SPSite -Identity "http://sharepoint.fahad.com/sites/siteB" –Path "C:\ Backups\siteA.bak" -force -verbose

The restore operation failed and gave me the below 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.

Reason

Both these site collections were in the same web application and it had only one content database. Microsoft uses the source site collection GUIDs during the installation. Though you delete the site collection from the web application, it leaves the GUIDs behind, and if you try to restore same site collection (same GUID) into same web application and content database, it would throw an error.

To resolve the issue, new content database needs to be created in the web application to restore the site collection.

Resolution

1.Create a new content database WSS_Content_siteB from Central Administration for your web application where your site collection is going to reside. Reference


2.Restore-SPSite -Identity "http://sharepoint.fahad.com/sites/siteB" -Path "C:\ Backups\siteA.bak" -force -verbose -ContentDatabase WSS_Content_siteB

No comments:

Post a Comment