0

I'm being unable to perform a backup in SQL Server 2005 installed on Windows 7 local machine. I was initially able to do so but as of now, every time I try I get the following message:

Backup failed for Server 'EBENEZERAKAGLO\SQLEXPRESS'. (Microsoft.SqlServer.Smo)

System.Data.SqlClient.SqlError: Cannot open backup device 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.3\MSSQL\Backup\Naass.bak'. Operating system error 5(Access is denied.). (Microsoft.SqlServer.Smo)

asked Feb 28, 2013 at 10:27
5
  • Does the account under which the backup is running have access to that folder? Commented Feb 28, 2013 at 10:29
  • Usually Windows7 keeps the folder C:\program files (x86) write locked for everyone. Your process doesn't have the permissions to write there. Commented Feb 28, 2013 at 10:29
  • or do you connect to that server remotely using any SQL management tools? Commented Feb 28, 2013 at 10:29
  • blog.sqlauthority.com/2011/04/13/… Commented Feb 28, 2013 at 10:33
  • I initially visited that link but I don't know the steps to follow to get to the SQL Server Properties window shown. Can you please show me the steps? Commented Feb 28, 2013 at 10:39

1 Answer 1

4

Well, suppose you have a command to execute your backup like this

BACKUP DATABASE [naass] 
TO DISK = N'C:\program files (x86)\Microsoft SQL Server\MSSQL.3\MSSQL\Backup\Naass.bak'' 
WITH NOFORMAT, INIT, 
NAME = N'naas-Complete Database Backup', 
SKIP, NOREWIND, NOUNLOAD, STATS = 10

this will fail if the process that executes this command doesn't have the permissions to write in the mentioned folder. And Windows 7 (for very good security reasons) keeps the C:\program files folders and its subfolders write locked also to an administrator account.

You could mess with the default permissions and give to your folder above write permissions for your account but of course this is not the recommended way.
Much better, simply change the script to work on a different directory on your disks.

BACKUP DATABASE [naass] 
TO DISK = N'D:\BackupSQL\naass.bak' 
WITH NOFORMAT, INIT, 
NAME = N'naas-Complete Database Backup'
SKIP, NOREWIND, NOUNLOAD, STATS = 10

Of course this new directory should have the correct permissions.

answered Feb 28, 2013 at 10:43
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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