• psangeetha (5/6/2009)


    Hi all,

    We are facing this critical issue, I need some help from you experts. I ran the encryption and decryption procedures on prod db and created a new master key on prod db in March 2009. It all worked fine. Our client refreshed their test db with prod data last week. Now, after the refresh to the test db last week, we are unable to decrypt the data on test db. I tried dropping and recreating the master key on test, still the decrypt value returns NULL. Both test db and prod db are SQL Server 2005 running on different servers. I'm confident that I'm using the same master key for both. Could there be any other possible issues here??? We are able to decrypt fine on the PROD db. Just the test db, the decrypt returns NULL.

    Please give me your suggestions. Thank you very much.

    I suppose you refreshed the testdb by using Restore database from production backup.

    You will need to add the prod db key to your test server

    (maybe have a look at my SSC article on Service Broker http://www.sqlservercentral.com/articles/Service+Broker/2897/)

    cfr

    USE Airline

    GO

    select *

    from sys.certificates

    ;

    select *

    from sys.master_key_passwords

    ;

    if not exists ( select MKP.*

    , D.name as DbName

    from sys.master_key_passwords MKP

    inner join sys.credentials C

    on MKP.credential_id = C.credential_id

    inner join sys.database_recovery_status DRS

    on MKP.family_guid = DRS.family_guid

    inner join sys.databases D

    on DRS.database_id = D.Database_id

    Where D.name = 'Airline'

    )

    begin

    Print 'Adding dbmasterkey for Airline';

    -- using the same password that has been used the first time !

    EXEC sp_control_dbmasterkey_password @db_name = N'Airline',

    @password = N'P@ssword', @action = N'add';

    end

    GO

    select MKP.*

    , D.name as DbName

    from sys.master_key_passwords MKP

    inner join sys.credentials C

    on MKP.credential_id = C.credential_id

    inner join sys.database_recovery_status DRS

    on MKP.family_guid = DRS.family_guid

    inner join sys.databases D

    on DRS.database_id = D.Database_id

    ;

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me