数据库备份启用加密

参考https://www.cnblogs.com/xwgli/p/4522502.html

 

@@@code

SELECT DB_NAME(database_id) AS DatabaseName, * FROM sys.dm_database_encryption_keys;

GO

 

 

USE master;

CREATE MASTER KEY ENCRYPTION BY PASSWORD = '$$$$';

 

USE master;

CREATE CERTIFICATE BackupCert WITH SUBJECT = '备份证书';

 

USE master;

BACKUP CERTIFICATE BackupCert TO FILE = 'c:\data\dbbak\bj_yun\BackupCert.cer'

WITH PRIVATE KEY ( FILE = 'c:\data\dbbak\bj_yun\BackupCert.pkey', ENCRYPTION BY PASSWORD = '$$$$' );

 

--还原证书

CREATE CERTIFICATE BackupCert FROM FILE = 'c:\temp\BackupCert.cer'

WITH PRIVATE KEY ( FILE = 'c:\temp\BackupCert.pkey', DECRYPTION BY PASSWORD = '$$$$');

 

@@#

 

还原时,无法解开备份集

数据库备份启用加密_第1张图片

 

进行密钥及证书导入后重新还原,文件被解开,可以列出备份集中的数据库名,正常还原

数据库备份启用加密_第2张图片

你可能感兴趣的:(数据库备份启用加密)