Restore-SPSite "http://dev.sharepoint2010/websites/0001" -path d:\temp\mybackup.bak -force

I want to restore a SiteCollection. 2 Days ago the same command works fine.

First I want to restore the SiteCollection without deletion. But I get an error in the PowerShell Console. Then I delete the SiteCollection and try it again. (The Database is not full and the maximum number of SiteCollection is not reached) Is there a TimerJob not finished? Possible solutions?

The Error Message:

Restore-SPSite "http://dev.sharepoint2010/websites/0001"
-path d:\temp\mybackup.bak -force  Restore-SPSite : No content databases are available for this operation but the site collection is scheduled for deletion in at least one content database.  Either wait for the deletion operation to complete or  create a content database, and then try the operation again. To create a content database, click "Content databases" on the Application Management page, select the Web application to use, and then click "Add  a content database". At line:1 char:15
+ Restore-SPSite <<<<  "http://dev.sharepoint2010/websites/0001"
-path d:\temp\mybackup.bak -force 
    + CategoryInfo          : InvalidData: (Microsoft.Share...dletRestoreSite:SPCmdletRestoreSite) [Restore-SPSite], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite
link|improve this question
Done all that and am still in the same boat. All I was trying to do was move a host header site collection to a new location. The old site was deleted. The timer job ran. Still the same message and no way to restore it. The -force flag has no effect. This is just stupid IMO. I'm specifying a different -url so why can't SharePoint exercise a little common sense and assign a new GUID?! – Panoone Mar 7 at 4:25
I'm encountering the same problem. Were you able to find a resolution? Thanks!! – user4747 Mar 12 at 18:38
feedback

3 Answers

Microsoft uses the source site collection GUIDs during the installation. If 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.

http://support.microsoft.com/kb/926321 - This is applicable to 2007 and 2010 also.

Use the -Force option from Restore-SPSite

link|improve this answer
1  
Thanks for your comment but I used the -force command. Look at my command – user2471 Apr 7 '11 at 12:15
feedback

the Error message ("No content databases are available for this operation but the site collection is scheduled for deletion.....".) is expected as the part of new feature in 2010 called as Gradual Site Delete in SharePoint 2010

I think the command will check the deletion queue before restoring :)

Try to see whether the Timer job [Gradual Site Delete] is executed then try the command again with -overrride (stsadm) as I am yet to use Power Shell :(

link|improve this answer
I'm getting the same results as the original poster. My Gradual Site Delete timer job is completing with 'Succeeded' however the Duration is 00:00:00 which is suspicious. I also use the -force option with the Restore-SPSite command. – user4747 Mar 12 at 18:54
feedback

I was also getting the same error. I had deleted the Site Collection through CA. I tried a 'Run Now' on the Gradual Site Delete timer job but still got the same error. (I had understood that it would clean up the GUID but it didn't seem to). The command 'Get-SPDeletedSite' showed me the site hadn't been completely deleted yet. 'Remove-SPDeletedSite' got rid of it. Then I was able to do the restore.

In the end, this is what worked for me as the cleanest/fastest procedure for renaming a Site Collection:

Backup-SPSite –Identity http://sharepoint.abc.com/sites/testsite -Path “c:\site collection backups\testsite.bak”

Remove-SPSite –Identity http://sharepoint.abc.com/sites/testsite

Restore-SPSite –Identity http://sharepoint.abc.com/sites/testsite2 -Path “c:\site collection backups\testsite.bak”

link|improve this answer
feedback

Your Answer

 
or
required, but never shown