1
votes

I have a job that backs up a production database saves it to disk with encryption.

BACKUP DATABASE MyFreshDB 
TO DISK='\\HomeServer\data\MyFreshDB.bak' 
with copy_only, init,MEDIAPASSWORD='8888'

But I get this error:

Msg 3279, Level 16, State 4, Line 1
Access is denied due to a password failure

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

The script above has been working fine for months, and removing the mediaPassword statement allows the backup to go ahead with no problems.

Any ideas?

1

1 Answers

1
votes

The problem was not with the script or password.

The job is scheduled to run every month, but someone ran a backup mid month - without a password, and replaced the backup file with their (unsecured) backup.

This caused the job to fail, as SQL Server (clearly) checks the password of the backup before writing over it. (which is interesting)