尝试恢复加密数据库时遇到问题 [英] having problems trying to restore encrypted database
问题描述
我尝试将加密的数据库从默认服务器复制到我的服务器进行测试
但我有麻烦这样做,因为我从来没有做过
因此我要解释我的程序和错误我得到
首先我创建一个主键:
使用主人
pre>
GO
创建主密钥加密PASSWORD ='DB-PaSSw0rD'
GO
现在可以使用:
命令已成功完成。
然后我通过导入在默认服务器上创建的证书创建证书:
CREATE CERTIFICATE TDECERT
FROM FILE ='C:\temp\TDECert.cer'
WITH PRIVATE KEY(FILE ='C:\temp\TDECertKey.pvk',
DECRYPTION BY PASSWORD = 'pAssW0rD')
GO
但我得到:
Msg 15581,Level 16,State 1,Line 1
请在数据库中创建主密钥或打开主密钥
来解决此问题,我尝试打开主密钥:
通过PASSWORD ='DB-PaSSw0rD'开始主键解密
ALTER MASTER KEY通过服务主键添加加密键
但我得到:
找不到对称密钥主密钥,因为它不存在或没有权限。
然后解决此第二个问题我尝试授予它访问:
GRANT CONTROL ON CERTIFICATE :: TDECERT管理员
但我得到:
找不到证书TDECERT,因为它不存在或您没有权限。
提前感谢您的时间
解决方案问题解决了
/ p>
使用主
>
CREATE CERTIFICATE TDECERT
FROM FILE ='C:\temp\TDECert.cer'
带私钥(FILE ='C:\temp\TDECertKey.pvk',
DECRYPTION BY PASSWORD ='pAssW0rD')
GO
并不需要任何其他
很容易!
Im trying to copy an encrypted database from the default server to my server for testing purposes
but im having troubles doing so because i have never done it so im going to explain my procedure and the errors i got
first i create a master key :
USE master GO CREATE MASTER KEY ENCRYPTION BY PASSWORD ='DB-PaSSw0rD' GO
all is good for now :
Command(s) completed successfully.then i create a certificate by importing the certificate created on the default server:
CREATE CERTIFICATE TDECERT FROM FILE = 'C:\temp\TDECert.cer' WITH PRIVATE KEY (FILE = 'C:\temp\TDECertKey.pvk' , DECRYPTION BY PASSWORD ='pAssW0rD') GO
but i get :
Msg 15581, Level 16, State 1, Line 1Please create a master key in the database or open the master key in the session before performing this operation.
to resolve this i try to open the master key:
OPEN MASTER KEY DECRYPTION BY PASSWORD ='DB-PaSSw0rD' ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY
but i get : Cannot find the symmetric key 'master key', because it does not exist or you do not have permission.
then to resolve this second issue i try to grant it access:
GRANT CONTROL ON CERTIFICATE :: TDECERT To Administrator
but i get :
Cannot find the certificate 'TDECERT', because it does not exist or you do not have permission.thanks in advance for ur time
解决方案problem solved
all i had to do is add
USE master
before
CREATE CERTIFICATE TDECERT FROM FILE = 'C:\temp\TDECert.cer' WITH PRIVATE KEY (FILE = 'C:\temp\TDECertKey.pvk' , DECRYPTION BY PASSWORD ='pAssW0rD') GO
and didnt need anything else
that easy!
这篇关于尝试恢复加密数据库时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!