【发布时间】:2017-09-22 21:52:56
【问题描述】:
尝试还原加密备份时,即使副本具有从生成备份的原始/主服务器恢复的主密钥 (dmk)、服务主密钥、证书和私钥,我也会在辅助副本上收到以下错误。
Msg 15581, Level 16, State 7, Line 137
Please create a master key in the database or open the master key in the session before performing this operation.
Msg 3013, Level 16, State 1, Line 137
VERIFY DATABASE is terminating abnormally.
为了规避错误,我像这样围绕操作打开和关闭主密钥。但是,在初级上,我不需要打开和关闭主密钥来进行操作。
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'MyTest!M4st3rPass';
RESTORE VERIFYONLY FROM DISK = '\\FS1\SqlBackups\SQL01\SystemDbs\msdb_backup_2017_09_22_171915_6346240.bak' WITH FILE = 1, NOUNLOAD, NOREWIND;
CLOSE MASTER KEY ;
我相信这是因为主服务器具有带有加密指纹的备份历史记录,但我想知道我是否遗漏了与辅助服务器相关的其他内容。
但是,毕竟,由于证书是在辅助节点上恢复的,所以我将它分配给用于备份加密的 SystemsDB 备份维护计划选项,但如果我出于同样的原因保持选中验证选项,则作业会失败。
Source: Back Up Database Task
Executing query "BACKUP DATABASE [master] TO DISK = N'\\FS1\SqlBac...".: 50% complete
End Progress
Error: 2017-09-22 17:08:09.28
Code: 0xC002F210
Source: Back Up Database Task Execute SQL Task
**Description**: Executing the query "declare @backupSetId as int select @backupSetId =..."
failed with the following error: "Please create a master key in the database or open the master key in the session before performing this operation.
VERIFY DATABASE is terminating abnormally.".
Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
End Error
【问题讨论】:
标签: sql encryption certificate sql-server-2016 private-key