Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.
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
share|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?! –  user7247 Mar 7 '12 at 4:25
    
I'm encountering the same problem. Were you able to find a resolution? Thanks!! –  user4747 Mar 12 '12 at 18:38
    
This post helped me a lot in troubleshooting my issue, thanks. I found that all I actually needed to do was restart the SharePoint 2010 Timer service. Once I did that and re-ran the Restore-SPSite command, it worked!!! –  user13537 Dec 11 '12 at 0:47
add comment

5 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

share|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
add comment

I had the same issue - this is how to solve it:

  1. Delete site collection (GUI or PS)
  2. Remove-SPDeletedSite => Delete from Recycle Bin
  3. Check with Get-SPDeletedSite
  4. Run Gradual Site Deletion Timer Job
  5. FINALLY: Restore with PS!
share|improve this answer
add comment

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

share|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 '12 at 18:54
add comment

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”

share|improve this answer
add comment

This is old, but I'll toss in what I just went through to get around this problem. In my situation, my web application had 2 content databases. I ran into the same problem as stated; could not restore content databases no matter what, even the "-Force" was useless.

My fix was to set the two content databases so that the current site collection count was also the max site collection account. Then, I created a new content database. After that, I could then do the restore.

While I have no idea why this was necessary, all I know is, "it worked." I suppose I could powershell script a backup of all site collections in the old content dabases, and a restore into the new one, but that's another project...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.