SQLTeam.com | Weblogs | Forums

Cannot open backup device. Operating System error 5


#1

When I have tried to backup my database I've received the following error message

Msg 3201, Level 16, State 1, Line 1
Cannot open backup device 'C:\Users\Admin\Desktop\Backup\MyData.bak'. Operating system error 5(Access is denied.).

Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.

Here is the query I have used:

BACKUP DATABASE MyData
TO DISK = 'E:\Backups\MyData.bak'
WITH FORMAT,
MEDIANAME = 'E_SQLServerBackups',
NAME = 'Full Backup of MyData';

#2

The SQL Server service account doesn't have permission to write to that disk location.


#3

may be a stupid question but why does

TO DISK = 'E:\Backups\MyData.bak'

give this error?

 'C:\Users\Admin\Desktop\Backup\MyData.bak'

Is E: drive really mapped to C:\Users\Admin\Desktop ?

This is all local on the Server that the DB is on, right? Not trying to backup to the local PC of a session connecting to the server via Terminal Services or something like that?


#5

A filemark in the backup device could not be read. There are many reasons why you may encounter a filemark error. Some of them are
media failure may occur on the device where the backup is located.
write failure may occur during the creation of the backup.

Look here: https://support.microsoft.com/en-us/help/290787/error-message-when-you-perform-a-database-backup-to-disk-or-tape-or-a-database-restore-from-disk-or-tape-3266,-3013