exec dbd_import_keys

This function is automatically created in an encrypted database at the moment of encryption. The database must be initially unlocked with the OPEN SYMMETRIC KEY DBDX statement. Call this procedure in the context of an encrypted database.

dbd_import_keys imports encryption keys to local storage using Windows Data Protection API and deletes .dbd_key files. The resulting files are hidden and not transferable to another computer or to another Windows account. If you change the account for SQL Server service the database will be unavailable. Before changing the account of SQL Server service, export keys with dbd_export_keys and use dbd_import_keys after the change.

By default, DbDefence creates exportable keys in the same folder with database data and log files. Key files have the .DBD_KEY extension.

Return Code Values

0 for success otherwise failure


use [mydatabase]
open symmetric key dbdx decryption by password='MyPass'
exec dbd_import_keys


To export keys run dbd_export_keys.