简体   繁体   中英

SQL Server Backup failing when using MediaPassword

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM