Sunday, March 28, 2010

What if you forget the password of Database Master Key (DMK)

Have you forgotten the Database Masker Key password of your database?
If yes, then execute the below statement in your database as soon as possible.
ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'YourPassword';
Have the statement completed? If yes, then be relaxed, you are at safer side now.
Is this really a matter of urgency?
Answer could be yes or no and that depends on the current configuration of Database Master Key. By default Database Master Key is encrypted by Service Master Key and Password both. And re-generating the password is not a matter of urgency. But if you have already altered the Database Master Key to drop encryption by Service Master Key, in that case password is the only weapon to recover that database if the database get corrupted.
NOTE: The REGENERATE option re-creates the database master key and all the keys it protects. The keys are first decrypted with the old master key, and then encrypted with the new master key. This resource-intensive operation should be scheduled during a period of low demand, unless the master key has been compromised.
You can get the syntax of ALTER MASTER KEY statement here:

No comments: