Now it’s time to take some backups. First, let’s back up the various keys and certificates:
123456789101112131415USE [master]
GO
--Back up the service master key
--Note that the password here is the FILE password and not the KEY password!
BACKUP SERVICE MASTER
KEY
TO
FILE =
'C:\Temp\ServiceMasterKey.key'
ENCRYPTION
BY
PASSWORD
=
'Service Master Key Password'
;
GO
--Back up the database master key
--Again, the password here is the FILE password and not the KEY password.
BACKUP MASTER
KEY
TO
FILE =
'C:\Temp\DatabaseMasterKey.key'
ENCRYPTION
BY
PASSWORD
=
'Database Master Key Password'
;
GO
--Back up the TDE certificate we created.
--We could create a private key with password here as well.
BACKUP CERTIFICATE [TDECertificate]
TO
FILE =
'C:\Temp\TDECertificate.cert'
WITH
PRIVATE
KEY
(FILE =
'C:\Temp\TDECertificatePrivateKey.key'
, ENCRYPTION
BY
PASSWORD
=
'Some Private Key Password'
);
GO
Click through for the details.