Home SQL Server Commands
 

BACKUP MASTER KEY

Export the database master key.

Syntax:
      BACKUP MASTER KEY TO FILE = 'path_to_file' 
	      ENCRYPTION BY PASSWORD = 'password'

Specify the complete UNC or local path, including file name, for the file to which the master key will be exported.

If password complexity is enforced, the password must be > 8 chars and contain upper/lower case and numeric/ Non-alphanumeric characters.

Before the master key is backed up, it must be open/decrypted.
If the master key is encrypted with a password, it must be explicitly opened.
If the master key is encrypted with the service master key, it does not have to be explicitly opened.

Backup the master key as soon as it is created, and store the backup in a secure, off-site location.

Example

 USE MyDatabase;
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'master_PAssword_g0es_h3re'; BACKUP MASTER KEY TO FILE = 'c:\backups\MyDb_masterkey' ENCRYPTION BY PASSWORD = 'key_P@ssw0rd'; GO

"Patience is the key to contentment" - Mohammed

Related Commands:

CREATE MASTER KEY
ALTER MASTER KEY
DROP MASTER KEY
RESTORE MASTER KEY



Back to the Top

Simon Sheppard
SS64.com