Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Certificates and Keys

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello, SQL Server 2008R2
If I create the master key, certificate, and symmetric key on server A\instance A and have log shipping setup to server b\instance b, will the keys and certificates be created for the second instance? So that if I need to failover we do not need to change code.
Thanks

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
To go along with this I also have the disaster failover problem. I can backup and restore the master key and the certificate, however, the symmetric key is where I am having a problem. If I use the IDENTITY_VALUE phrase I can recreate the key on the same session. If I do not use the IDENTITY_VALUE I cannot recreate the key. BOL say that the IDENTITY_VALUE should only be used for temporary keys.

I found MS suggests using reporting services to backup/restore the symmetric key but it did not work when I followed thier instructions.

So is there a way to backup or re-create the key without the IDENTITY_VALUE?

Here is my code
Code:
CREATE SYMMETRIC KEY My_Key_01 
    WITH ALGORITHM = AES_256, 
        KEY_SOURCE = 'abccd'
        ,IDENTITY_VALUE = 'phrase1' 
    ENCRYPTION BY CERTIFICATE MyCert01;
GO

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Well I found an interesting article "Cloning" Symmetric Keys" by Michael Coles. This worked well.

What I have done is stored a backup of the master key, certificate, certificate encryption file. Also keep the Key_Source and Identity_Value phrases. These are not used at this time but are for disaster recovery.

Create a backup of the database.

Go to a different server, restore the database, in SSMS, go to the database, open the master key (password needed), execute the command:
Code:
ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY 
GO
then open the symmectric key.


djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top