Tuesday 27 November 2007

stsadm restore Results in Access Denied 0x80070005

Restoring a content database using stsadm -o restore usually works pretty well. We use this command to restore content backups from our authoring environment to our local development environments.

Because our authoring environment is administered by one of the operations guys, however, I frequently receive an Access Denied error from stsadm that reads like this:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

The 12 Hive log file offers up the full stack trace but reveals nothing of any real interest. Bear in mind, I'm logged in to my development server (W2k3) using my AD credentials and I'm a local administrator. An earlier log entry tells me stsadm.exe is dealing with a request from me so I know everything is pretty much okay. Of course it's not and I'm getting the above error.

The solution lies with the fact I'm not listed as a site collection administrator for the old site collection that's being replaced.

Luckily, I can change this quite easily. Fire up the the Central Administration console and browse to the Application Management tab. Select the Site collection administrators link in the SharePoint Site Management section and configure yourself (or the relevant account name) as the Secondary Site Collection Administrator. Unfortunately you can't specify a group as either primary or secondary administrator. As a result I'll also have to do this again before the next restore since I'm not a site collection admin in authoring.

Update: Poolio (see comments) and I have both run into this problem all over again after the source site collection is locked before the backup is kicked off. To work around this, remove the lock:

stsadm -o setsitelock -url [url] -lock none 
 

15 comments:

  1. It's working.
    Thanks.

    ReplyDelete
  2. Thanks alot - I was just crasy about this message...

    ReplyDelete
  3. Solved it for me. Thanks for the insight!

    ReplyDelete
  4. Thanks for your spot on solution. worked, then I closed all those long stories.

    ReplyDelete
  5. This can also happen if you've previously put the site collection into read-only mode (stsadm -o setsitelock -url [url] -lock readonly). It's quite possible that you would do this before taking the backup, and forget to undo it before doing the restore.

    To undo and make the site writeable, use

    stsadm -o setsitelock -url [url] -lock none

    ReplyDelete
  6. Thanks Poolio! I actually came across the exact same problem two weeks ago and was meaning to update this post!

    ReplyDelete
  7. awesome. First hit on Google and a quick and easy fix! thanks.

    ReplyDelete
  8. Many thanks Michael and ditto of Colin's comment.

    PS: one of my fav quote, "Don't worry about the world coming to an end today. It's already tomorrow in Australia." by - Charles Schulz .

    chella5000atgmaildotcom

    ReplyDelete
  9. thanks for your solution for my solution :) i added myself as backup administrator and ran a dos-box(commandprompt) as myself (being domain admin) and now it worked just fine ;)

    Gtx Hillbird

    ReplyDelete
  10. It worked for me too :)
    Thanks

    ReplyDelete
  11. Thanks
    its working for me
    thanks for ur solution

    ReplyDelete
  12. Thanks for this solution - you saved me possibly weeks of unsuccessfull trolling of the Microsoft website. Excellent stuff!

    ReplyDelete
  13. Thanks for this quick help.
    Saved my few hours

    ReplyDelete
  14. Thanks Michael, solved it for me too :)

    ReplyDelete
  15. Thanks for this solution

    ReplyDelete

Spam comments will be deleted

Note: only a member of this blog may post a comment.