BACKUP MASTER KEY (Transact-SQL)
Exports the database master key.
The master key must be open and, therefore, decrypted before it is backed up. If it is encrypted with the service master key, the master key does not have to be explicitly opened. But if the master key is encrypted only with a password, it must be explicitly opened.
We recommend that you back up the master key as soon as it is created, and store the backup in a secure, off-site location.
The following example creates a backup of the AdventureWorks master key. Because this master key is not encrypted by the service master key, a password must be specified when it is opened.
USE AdventureWorks; OPEN MASTER KEY DECRYPTION BY PASSWORD = 'sfj5300osdVdgwdfkli7'; BACKUP MASTER KEY TO FILE = 'c:\temp\exportedmasterkey' ENCRYPTION BY PASSWORD = 'sd092735kjn$&adsg'; GO