Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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:empTDECert.cer'
WITH PRIVATE KEY (FILE = 'C:empTDECertKey.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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
445 views
Welcome To Ask or Share your Answers For Others

1 Answer

problem solved

all i had to do is add

USE master

before

CREATE CERTIFICATE TDECERT
FROM FILE = 'C:empTDECert.cer'
WITH PRIVATE KEY (FILE = 'C:empTDECertKey.pvk' , 
DECRYPTION BY PASSWORD ='pAssW0rD')
GO

and didnt need anything else

that easy!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...