Error while restoring a database from a backup

  • I am trying to restore a database from a backup (.bak) file which is in shared folder where the instance has all access privileges. That shared folder is different from the DATA folder where the original .mdf file is kept. Now when I am trying to restor, it brings an error showing that Access is denied to DATA folder. 
    I want to know why it needs access to DATA folder if I am restoring from a backup? Why it needs the original .mdf file? and access to that folder?

    Thanks for your time!

  • 1.  If you're trying to do a restore over an existing database, you need to use the REPLACE option.  Remember that this will overwrite the existing database and, if you don't have recent backups of the existing database, you will lose any and all data since the time of the backup that you're trying to restore unless you take the proper steps for a "Tail Log" backup.. 
    2. If you're trying to do a restore to a different box, then you probably have provide new file paths for the new MDF/LDF so it can "move" the database.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I had this issue in SQL Server 2012. I fixed my issue by enabling 'Relocate all files to folder' option under the 'File' section in Restore Database.
    Or may be you have already restored the database previously and you didn't check the checkbox of 'Overwrite existing database' in your restore wizard.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply