尝试恢复加密数据库时遇到问题
我试图将加密数据库从默认服务器复制到我的服务器以进行测试,
但我在这样做时遇到了麻烦,因为我从未这样做过 所以我要解释我的程序和我首先遇到的错误
我创建了一个主密钥:
USE master
GO
CREATE MASTER KEY ENCRYPTION BY 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
但我得到:
消息 15581,级别 16,状态 1,第 1 行
请在执行此操作之前在数据库中创建主密钥或在会话中打开主密钥。
解决此问题尝试打开主钥匙:
OPEN MASTER KEY DECRYPTION BY PASSWORD ='DB-PaSSw0rD'
ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY
但我得到: 找不到对称密钥“主密钥”,因为它不存在或您没有权限。
然后为了解决第二个问题,我尝试授予它访问权限:
GRANT CONTROL ON CERTIFICATE :: TDECERT To Administrator
但我得到:
找不到证书“TDECERT”,因为它不存在或您没有权限。
提前感谢您的宝贵时间
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 1
Please 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了
我所要做的就是添加
以前
,不需要任何其他东西
那么简单!
problem solved
all i had to do is add
before
and didnt need anything else
that easy!