15

I ran Restore-SPSite on my server from a backup. I then deleted the site collection and did it again but got the following 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.

This is because the same GUID is used twice in the content database. The way round this is to create a new content database.

What happends if I don't want to do that? What can I do? Is there any way I can force it in? Can I change the GUID and reeport import?

5 Answers 5

14

This is a known issue[citation needed] and unfortunately restoring to a new content database is the only workaround (I refuse to call it a solution since you now have a new problem). Once restored, you can't move the site back either; the error it returns is about how the site used to exist in the content database.

If you can, avoid deleting site collections you intend on restoring again later. Use the -force parameter with Restore-SPSite or the -overwrite parameter with stsadm -o restore

5
  • I'm using the -overwrite parameter, however I get the same error.
    – PeterX
    Commented Mar 18, 2014 at 1:43
  • Are you receiving the error after deleting the site collection? Are you trying to restore a site collection over an existing site collection that has never been deleted?
    – shufler
    Commented Mar 18, 2014 at 13:13
  • The latter - an overwrite.
    – PeterX
    Commented Mar 19, 2014 at 23:06
  • @PeterX I think you may have a different issue.The bug I've described happens when you delete a site collection and then attempt to restore it.
    – shufler
    Commented Mar 19, 2014 at 23:15
  • 1
    Perhaps, same error message though.
    – PeterX
    Commented Mar 19, 2014 at 23:56
5

When you delete a Site Collection, it will still remain in the Content database until the "Gradual Site Delete" Timer job is run (by default, it runs once daily). So, once you delete the site collection and run the timer job, then you can again restore the same site collection in the same content database.

1
  • Just to add to this answer. There are some rare situation (usually related to backup/restore operations) where even the timer job won't help. If this is the case, you may resort to the SPContentDatabase.ForceDeleteSite method (link for 2013 version, available also on older vers). Commented Dec 19, 2012 at 8:50
3

Sorry to resurrect such an old thread however I ran into a similar problem today and this http://reality-tech.com/2012/04/04/gradual-site-collection-deletion/ post put me onto the solution. This meant I didn't have to install to a different content database which would have been a big headache for us. Hopefully this might help someone in the future...

1
  • 1
    Don't apologise, resurrecting old posts with new information is part of the point! I'm not clear, though it sounds like the steps in that post show how to remove a deleted site permanently so Restore-SPSite of the site will work again. Is this the case?
    – shufler
    Commented Aug 23, 2012 at 21:02
0

The cause is the site collection was deleted from the GUI. This causes (insert AAAARGH Microsoft here) the site to be deleted using the gradual delete parameter. Gradual delete means the site is not really deleted from the content database, it is, as the name implies, gradually deleted by a timer job that runs daily. This is done so if it is accidentally deleted (deleting without backing up is bad anyways) it can be recovered. The only way to permanently delete without gradual delete is using powershell and the delete-spsite command. If you are already in a state where you deleted from the GUI, you need to use the Remove-SPDeletedSite command to delete the site before you can recreate it again. You can use Get-SPDeletedSite to see the sites in such a state, then delete them using Remove-SPDeletedSite -Identity and using either the GUID or URL.

0

I ran into the same issue. This worked for me:

Add a new content database in CA, to the same Web Application.

run this PowerShell command:

restore-spsite -identity URL -force -DatabaseServer NAME -DatabaseName NEW_DB

this will target the fresh, empty DB for your restore process! after that, you can move your other site collections to the new DB and delete the old one, if you wish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.