0

I have backup my site collection found on the root. then i wanted to resote it on a different location, so i did the following steps:-

1.using the central administration , i delete the site collection.

2.then i run the following powershell command , where i got the siteid for the deleted site collection

Get-SPDeletedSite

3.i run this powershell command:-

Remove-SPDeletedSite <the above site id>

4.after that i tried restoring the site collection as follow:-

PS C:\Users\spfarm.srv> Restore-spsite -identity http://servername/KB/PMO  -Path C:\Newfolder\0112.bak

but i got this exception:-

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:1 + Restore-spsite -identity http://servername/KB/PMO -Path C:\Newfo ...

another appraoch i created a new site collection on the same url, then i use the -force command as follow:-

PS C:\Users\spfarm.srv> Restore-spsite -identity http://servername/KB/PMO  -Path C:\Newfolder\0112.bak -force

but i got the same exception. so can anyone adivce on this please ?

now i manually run the "gradual site delete" job, then i try restoring the site collection , but this time i got this error:-

Restore-spsite : <nativehr>0x80070003</nativehr><nativestack></nativestack> At line:1 char:1
    + CategoryInfo          : InvalidData: (Microsoft.Share...dletRestoreSite:    SPCmdletRestoreSite) [Restore-SPSite], DirectoryNotFoundException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreS    ite

2 Answers 2

1

First option is easy to resolve.

When you delete a site collection > it goes to Central admin recycle-bin > from there when you run remove-Spdeletedsite, it marked for the deletion and a timer job responsible to remove it completely.That time job schdule run daily around mid night to remove all the sites( which are marked for deletion with the remove command or 30 days old).

Gradual Site Delete, this timer job which remove it.

In your case just got to Central admin > Monitoring > Job definitions ...On this page, select the web application you trying to restore and now manually run the Gradual Site Delete timer job.

wait for completion then run the restore again.

6
  • unfortunately this did not work. now i read that this might be a permission problem, now i was logined using the Sharepoint farm, and using this username i was able create site collection using the UI, perform a backup ,etc.. but when i tried restoring a site collection i got these errors. so now i login with the sharepoint admin account ,, run the restore and it worked... i thought i lost my work !!! this case is really strange ,, so using the farm account i can create, delete , backup site collections... but can not restore !!
    – John John
    Commented Dec 1, 2016 at 18:20
  • 1
    When you run the powerShell for restore at that time make sure the your account(under which you login) should have access to the content Database where this restore is going to happen. DBO rights
    – Waqas Sarwar MVP
    Commented Dec 1, 2016 at 18:51
  • Yes i just notice this .. but how come i can Create & Delete a site collection from the UI using this account ,, but i can not restore the site collection.. this does not make sense.. i thought for a while that i lost my site collection!!never thought that the username i am using which can delete a site collection from the UI can not restore a site collection using powershell!!
    – John John
    Commented Dec 1, 2016 at 23:15
  • 1
    You are right but it is by design...check this blog, which will tell u more about social.technet.microsoft.com/wiki/contents/articles/…
    – Waqas Sarwar MVP
    Commented Dec 1, 2016 at 23:20
  • 1
    That is correct, farm admin ( account which run timer services,central admin apppool)is the account which can do restore...other user part of farm administrator group can't do restore
    – Waqas Sarwar MVP
    Commented Dec 1, 2016 at 23:51
0

I have also faced the same issue even after running the Gradual Site Delete timer job and Remove-SPDeletedSite

It worked only after adding the DatabaseServer and DatabaseName (to an existing DB) parameters. Please ensure the database server name is correct if there are aliases. You can pick it from "cliconfg" from Windows->Run or from by clicking on existing database name in CA.

Restore-SPSite 'site collection url here' -Path C:\Backup\site_name.bak -Force -DatabaseServer "server name here" -DatabaseName "db name here"

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.