7

Our DBA is out and I'm trying to back up our (remote) dev database to a UNC path. I'm running the back up operation while logged into Management Studio as a particular Windows domain account (e.g. CORP\myUser). I've checked that this domain account has FULL CONTROL rights the UNC path \\nameOfMachine\backup\.

When I attempt to execute the following as CORP\myUser

BACKUP DATABASE [DEV] TO  DISK = N'\\nameOfMachine\backup\dev.bak' WITH COPY_ONLY, INIT;

I receive the error

Cannot open backup device '\\nameOfMachine\backup\dev.bak'. 
Operating system error 5(Access is denied.).

Which seems to indicate that whatever account SQL Server is using to run the backup command does not have rights to that UNC path.

I do not have a way to RDP to the dev database server and find out which account SQL Server is using to execute the backup command above. Is there a way to find this out from Management Studio using e.g. a dynamic management view?

T. Webster
  • 319
  • 1
  • 3
  • 8

3 Answers3

6

If you run a BACKUP query under a certain Windows/SQL Server account, it is actually the SQL Server Agent account which "does" the BACKUP and needs full control permissions to the UNC path. So you must be able to allow that account (or Everyone) have full control permissions to that path. To find out which account SQL Server Agent runs as, query sys.dm_server_services. It requires that you (or someone else) have VIEW SERVER STATE permission on the server.

T. Webster
  • 319
  • 1
  • 3
  • 8
5

BACKUP will access the UNC under an impersonation context. This is a 'double-hop' situation and requires Kerberos constrained delegation to be configured.

This is already answered at https://stackoverflow.com/questions/18749224/restore-database-from-a-shared-folder

Remus Rusanu
  • 52,054
  • 4
  • 96
  • 172
4

Do you have the option of creating a folder on your local computer and create a share on that and grant full authority to everyone and then back up to that share? - you didn't indicate how big the backup might be

Scott Hodgin - Retired
  • 24,062
  • 2
  • 29
  • 52