SQL Server Developer Center > SQL Server Forums > SQL Server Database Engine > Cannot open backup device 'F:\foldername'. Operating system error 5(Access is denied.).
Ask a questionAsk a question
 

AnswerCannot open backup device 'F:\foldername'. Operating system error 5(Access is denied.).

Answers

  • Tuesday, March 07, 2006 7:49 AMMigrationUser 1 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    It doesn't matter who *you* are logged in as, it is the service account for SQL Server service that 
    matters
    
    -- 
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    Blog: http://solidqualitylearning.com/blogs/tibor/ 
    
    

All Replies

  • Monday, March 06, 2006 11:33 PMSimon SabinMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    You need to check the security permissions on the folder you are trying to backup to. Make sure the service account (Network Service) has write permissions. It may well not do.

    SQL on changing the service account changes the permissions on the critical drives it knows about but won't to it for all the drives in a server.

  • Tuesday, March 07, 2006 3:08 AMNoEgo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    well I added Network Service with the right permissions.  Still same error.  Like I said before this was never a problem.  I am the only one who touches the server and I haven't changed permissions except to change what permissions Network Service had in logons but I changed that back wto what it was previous and what my other server has in SQL logins.
  • Tuesday, March 07, 2006 7:49 AMMigrationUser 1 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    It doesn't matter who *you* are logged in as, it is the service account for SQL Server service that 
    matters
    
    -- 
    Tibor Karaszi, SQL Server MVP
    http://www.karaszi.com/sqlserver/default.asp
    http://www.solidqualitylearning.com/
    Blog: http://solidqualitylearning.com/blogs/tibor/ 
    
    

  • Tuesday, March 07, 2006 3:54 PMNoEgo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks a lot NNTP, that was it. I added my domain account that I had created to run all SQL Services to the security of the partitions on my server and I have access now.  I'm not sure though what changed, I was able to do this before unless someone took this login out of the security..I guess it's possible but as far as I know nobody it touching my server
  • Friday, April 28, 2006 2:51 AMmilocr Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Tnks God I found this post... It really save me!!!

    rgds

  • Tuesday, August 29, 2006 1:55 PMPaul Monaghan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    I have the same problem. I have changed the SQLAGENT  service to run as domain\administrator but are you suggesting the sql server instance service also?

    Thanks

    Paul

     

     

     

  • Thursday, September 07, 2006 1:01 PMBrandano Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    On a Windows 2000 Server with SQL Express 2005 freshly installed, giving the "SYSTEM" user full control on the target folder seems to do the trick without the need to change the service user.
  • Tuesday, September 26, 2006 7:16 PMJerry Hung Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    SQL Service account is DOMAIN\SQLAdmin

    Have given the SQLAdmin AD account access to the Backup shares on the file servers (2 file servers, FILE1, FILE2)

    and I still get the error

    Operating system error 5(Access is denied.).

    RESTORE FILELISTONLY

    FROM DISK = N'\\SERVER\APPS\backups\UA\DB\DB.BAK'

    I trid to attach it as device, which runs

    sp_addumpdevice 'disk', 'Network_Share', '\\SERVER\backup\APPS\UA\DB\DB.BAK'

    BUT when restoring, same error occurred (Access denied)

    Only case I can backup/restore to/from network shares, is from the machines where SQL Server runs (SQL1, SQL2)

    e.g. I copy the BAK file from FILE1 to SQL2, share the folder (add SQLAdmin account with access), then restore on SQL1 with file from SQL2 Share

    RESTORE FILELISTONLY

    FROM DISK = N'\\SQL2\backups\UA\DB\DB.BAK'

  • Friday, March 30, 2007 10:35 AMmoonguy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    When you try to backup, SQL Server 2005 shows the default backup path i.e. c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\ . This directory default has SQL user rights. Go to Backup directory and check the user name. Its very big name and I have not checked how SQL server adds it in allowed users list. You can do 2 things:

     

    1. Let the Server take backup on default directory and copy the file in your desired folder. I did that.

    2. Give same kind of permissions to your desired folder as Backup directory has.

     

    Hope it solves the issue.

     

    Moonguy

     

     

  • Monday, June 04, 2007 7:53 PMDolphins Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    This problem occurs when you are attempting to backup to a UNC patch and the SQL server does not have "modify" rights to the backup path. With the backup path sharepoint, and on the backup directory itself, grant the SQL server "modify" rights - when doing this be sure that "computers" is selected under "object types"

     

     

    Hopes this helps

  • Tuesday, September 11, 2007 2:10 PMMoojjoo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You are a life saver...  This was driving me nuts.  I must add this to my blog.....

     

  • Wednesday, September 12, 2007 6:45 AMEasternBoy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks alot MoonGuy,

    also i found that the installation path & Backup Directory of SqlServer Express can be found at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer in BackupDirectory key.


  • Monday, November 05, 2007 9:00 PMRohit Nayak - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I ran into a similar scenario where I wanted to backup my Testing databases on to the E:\ of my Dev database server for storage.

     

    I just added the service account (LOCAL\sql05svc)  for Sql Server into the local admin group on the Dev machine where I am writing the backups to and it worked out fine too. The account did have the same password on both machines though.

     

    I am guessing you could do the same with a Domain account that you use to run Sql Server service with.

     

  • Friday, December 07, 2007 9:53 AMAzhar_kazi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hey wat is the solution?? Can u plz share with me, I dint get wat exactlly u guys are talking about...  I am getting the same problem, I have a user_account and i dont know what permisions it has, I took a backup from the system connected in LAN, and when i tried to restore the database after taking backup, I got this error.  Its troubling a lot yaar, plz get me a solution and take me out of this.....

     

  • Sunday, January 13, 2008 5:30 PMArxigos Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    great help..i had the same problem and i have resolve it doing the follow

     

    my operating system is winXP pro.

    and MSDE 2005

     

    Control panel->administrative tools->services-> SQL Server

    at the properties i choose 'log on as: local system account and also choosed to allo service to interact with desktop'

     

    thanks for the help i have spent more than four hours googling for it

     

  • Tuesday, January 29, 2008 2:11 PMDominicWatson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    "Control panel->administrative tools->services-> SQL Server

    at the properties i choose 'log on as: local system account and also choosed to allo service to interact with desktop'"

     

    If I believed in a God I'd ask him/her/it to bless you. I love it when people explain things Wink

     

    Dominic

  • Friday, April 25, 2008 5:42 AMAvenueStuart Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This happened to me when I attempted to create a new database from a .bak file using RESTORE.  I just right-clicked on the .bak file, selected Properties and then clicked the Security tab.  Then, I did a Check Name for "SQL" and added the following two SQL accounts from the list:

    1)  SQLServer2005MSSQLUser$<machine name>$MSSQLSERVER

    2)  SQL

    The reason this happened to me is because I was attempting to create a database from a .bak file which was not created on my machine.  Whenever you backup an existing database, the above SQL accounts are already added to the security profile of the backup file.  Because I was using a .bak file created on another machine, the necessary SQL accounts on my machine hadn't been granted permissions.  Adding them manually helped. 

    If you run into a similar problem at the folder-level, try right-clicking to see if the above two accounts exist within the Security tab. 
  • Friday, June 06, 2008 5:39 PMTrisped Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks, that helped a lot.

     

     AvenueStuart wrote:
    This happened to me when I attempted to create a new database from a .bak file using RESTORE.  I just right-clicked on the .bak file, selected Properties and then clicked the Security tab.  Then, I did a Check Name for "SQL" and added the following two SQL accounts from the list:

    1)  SQLServer2005MSSQLUser$<machine name>$MSSQLSERVER

    2)  SQL

    The reason this happened to me is because I was attempting to create a database from a .bak file which was not created on my machine.  Whenever you backup an existing database, the above SQL accounts are already added to the security profile of the backup file.  Because I was using a .bak file created on another machine, the necessary SQL accounts on my machine hadn't been granted permissions.  Adding them manually helped. 

    If you run into a similar problem at the folder-level, try right-clicking to see if the above two accounts exist within the Security tab. 

  • Tuesday, June 10, 2008 2:38 PMChobby Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    "Control panel->administrative tools->services-> SQL Server

    at the properties i choose 'log on as: local system account and also choosed to allo service to interact with desktop'"

    totally agree. otherwise i was still lost. Thanks heaps.
  • Tuesday, June 10, 2008 8:36 PMManuji Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Make sure you dhould be having enough access on the drive. from SQL level and OS level too.
  • Tuesday, June 17, 2008 5:42 PMVitokogvy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     Arxigos wrote:

    great help..i had the same problem and i have resolve it doing the follow

     

    my operating system is winXP pro.

    and MSDE 2005

     

    Control panel->administrative tools->services-> SQL Server

    at the properties i choose 'log on as: local system account and also choosed to allo service to interact with desktop'

     

    thanks for the help i have spent more than four hours googling for it

     

     

    Thank you for explaining, i was lost, and i didnt know wut else to do thanks

  • Friday, August 08, 2008 3:13 PMSprint Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I was having the same problem trying to restore a backup file sent to me.  Heres how I fixed it:

    Copied the backup file into SQL's default backup directory (Program files\SQL\MSSQL.1\Backup)

    Right clicked the file, properties

    Under Security clicked Advanced

    Check "Inherit from parent...." apply and ok


    Should do the trick....in my case the directory had the right permissions so if I did a backup the file would get the right permissions but on a file sent to me it did NOT have the right permissions.  Doing this assigns the same permissions and the backup folder and also then you don't have to make any other system changes since you just changed the file.  Hope this helps someone.

    -Allan
  • Thursday, August 21, 2008 1:57 PMErnewein Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, this solution worked for me
  • Tuesday, September 30, 2008 10:49 PMa.............._ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you Simon Sa,
    Even i had the same error while i was trying to backup to my local drive and I added my NETWORK SERVICES to allow to write onto my local Drive this was very helpful to me Thankuuu....
  • Thursday, October 02, 2008 2:20 PMPranay Sharma Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     Arxigos wrote:

    great help..i had the same problem and i have resolve it doing the follow

     

    my operating system is winXP pro.

    and MSDE 2005

     

    Control panel->administrative tools->services-> SQL Server

    at the properties i choose 'log on as: local system account and also choosed to allo service to interact with desktop'

     

    thanks for the help i have spent more than four hours googling for it

     


    This worked perfect for me.
    Thanks!!!
  • Monday, October 06, 2008 4:05 PMGlennBelardo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for all who gave this great info. Save me a lot of time...

     

  • Thursday, October 23, 2008 6:23 AMeralper Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Hello all,

     

    I had a similar issue with this problem while restoring a database backup file.

    We were able to solve the problem by giving Read permissions to the SQLBrowserUser.

     

    You can find the discussions at http://www.kodyaz.com/forums/thread/3515.aspx

     

  • Thursday, October 23, 2008 2:00 PMSQLDBA_Quest_4_Knowledge Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank You Thank You Thank You - This saved me too. I'm so thankful for you taking the time to reply.

     

  • Friday, November 21, 2008 6:59 AMBerkant Bilgi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    İt worked for me . Thank you very much Simon.

    I added NETWORK and NETWORK SERVICE accounts to the copy folder permisssions and security tabs.

     

     SimonS_ wrote:

    You need to check the security permissions on the folder you are trying to backup to. Make sure the service account (Network Service) has write permissions. It may well not do.

    SQL on changing the service account changes the permissions on the critical drives it knows about but won't to it for all the drives in a server.

  • Friday, January 23, 2009 5:07 PMRandyB Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    Just a google searcher who found your post and wanted to say thanks!  Your directions solved my issue.  Appreciate you taking the time to write it down!

    -RandyB

  • Wednesday, February 18, 2009 9:29 AMlogN Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi  Arxigos,

    Thanks...
    alg
  • Thursday, July 30, 2009 8:57 AMNGAbalo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Same problem, same solution... thanks a lot.
  • Wednesday, August 12, 2009 4:30 PMBenZodAero Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi I seem to be running into a similar issue. Trying to use the DBCopyTool from codeplex, my issue is that I receive the error when the application is trying to copy the .bak file from my local machine to the backup folder on the remote machine...so I new to SQL any detailed response would be helpful seems like most users are receving a .bak file to restore...I'm sending a file to a remote machine to have it restored, thanks.

    Error restoring the database. Cannot open backup device 'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\QCTL_new_CopyTool.bak'.
    Operating system error 2(The system cannot find the file specified.).
    RESTORE FILELIST is terminating abnormally.
  • Monday, September 28, 2009 9:06 PMRosebuds Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I tangled with the same problem.  I solved it by changing the SQL Server Service Logon to Local System.  Which is weird because all my other SQL Servers use the NetworkService account.  

    I've backed up and restored dozens of databases on many different servers all over the place and I've only seen this problem on this one machine.  I'm not sure why this is like this.  

    The machine was recently rebuilt due to a RAID failure but I'm not sure that was the problem.  Bizarre.  

    If anyone finds out why this happens in the first place I'd really like to know.  


  • Wednesday, September 30, 2009 10:16 AMdkv2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks to  Arxigos,

    Was also googling several hours to find an answer.


    Thanks again for the solution.

    DKV
  • Friday, October 23, 2009 6:49 AMSpiderX81 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    you guys are real life-savers. you save my day.

    Man may come and Man may go, but I go on forever
  • Wednesday, November 04, 2009 11:22 PMTim Ely Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Saved me too.  This one made no sense.  I was working with an application called MediaBin which invokes the backup out of SQL 2005.  Well, I moved the repository for MediaBin to a new bigger location and the backup immediately failed.  Thank god I was able to find the error message "Operating system error 5(Access is denied.)" in a log file.  Thanks!