Recently I was asked to move a site collection from one farm to the other. No problem, piece of cake, right?
That what I thought and ran the command: Restore-spsite …..After running backup-spsite command, but I got the following exception:
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.
It sounds very strange, because you are even not close to the limit of content database capacity. So what is the reason?
The reason is in internal processes which occur when you restore the site collection. When you deleted your site collection first time in Sharepoint it is not really deleted. As I said above you still have possibility to restore it from recycle bin. And its id prevents you form further tries to restore the same site collection in the same web application. What to do then?
First of all check the list of deleted site collections using Get-SPDeletedSite cmdlet. It may give you something like this:
PS C:temp> Get-SPDeletedSite
WebApplicationId : 35513b1d-408f-4643-b5f2-b417aaa252f0
DatabaseId : 2bd59a50-7a94-4869-88af-ae1988be18fc
SiteSubscriptionId : 00000000-0000-0000-0000-000000000000
SiteId : fc5ff8c9-2012-4fd8-b801-9a0efb0e71cd
Path : /test
DeletionTime : 14.12.2012 12:49:18
It means that there is site collection with “/test” relative url, which you can still restore. It prevents you from restoring of your site collection 2nd time. We need to remove this site collection completely. It can be done by 2 steps. First step is to use Remove-SPDeletedSite cmdlet with guid which you got from Get-SPDeletedSite command above:
Remove-SPDeletedSite –Identity fc5ff8c9-2012-4fd8-b801-9a0efb0e71cd
After that Get-SPDeletedSite won’t show this site collection, but Restore-SPSite will still give the same error. The second step: go to Central administration > Monitoring > Job definitions and run the “Gradual Site Delete” job for the web application where you are trying to restore the site collection. After that wait some time (depends on the size of your site collection) and try to restore site collection again. This time it should work without problems.