SQL Server database backup: Network Service file access

Posted by Keith Maurino on Stack Overflow See other posts from Stack Overflow or by Keith Maurino
Published on 2010-03-25T14:47:41Z Indexed on 2010/03/25 14:53 UTC
Read the original article Hit count: 508

Filed under:
|

When trying to run the following database backup command from my code I get an "Operating system error 5(Access is denied.)" error. This is because the log on account for the SQL Server Windows Service is 'Network Service' and that does not have access to right to this folder.

BACKUP DATABASE [AE3DB] TO DISK = 'c:\AE3\backup\AE3DB.bak'

My question is, from my code how would I go about figuring out where on the C drive 'Network Service' is allowed to right the backup to?

NOTE: This is a distributed application so I cannot easily change the log on for the SQL Server Windows Service to the 'Local System' account that would be able to right to that folder.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about backup