0
votes

I am using:

$ sqlcmd -S gigbat -d FOD -Q "BACKUP DATABASE [FOD] TO DISK='C:\testDBbak1.bak'"

Msg 3201, Level 16, State 1, Server gigbat, Line 1 Cannot open backup device 'C:\testDBbak1.bak'. Operating system error 5(Access is denied.). Msg 3013, Level 16, State 1, Server gigbat, Line 1 BACKUP DATABASE is terminating abnormally.

I assume it is trying to write to the server's c drive?

How can I specify my local c drive?

1
What happens if you run md C:\foo ?Marged
I am in cygwin. mkdir cygdrive/c/foo will create a new directoryManInMoon
Have a look at stackoverflow.com/questions/2476508/… and try to find out which account and file is causing the problem. Procmon can filter for errors, then you will see what is going wrong.Marged

1 Answers

1
votes

Doesn't this message say it all?

Operating system error 5(Access is denied.)

This just means that the account being used to run the sqlcmd command does not have access to C:\. If it is a windows account, you can try granting required permissions on that drive.

Also storing in the root of the boot partition is not a good idea. Consider creating a folder, assigning required access privileges and write to that folder