Database Reference
In-Depth Information
Creating a database master key for the master
database
Creating the database master key is important because it is used to protect the
private key certificate and the asymmetric keys that are stored in the master
database, which will be used to encrypt the SQL Server backup. The following
Transact-SQL will create a database master key for the master database:
USE master;
GO
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'P@$$W0rd';
GO
In this example, a simple password has been used. In a production environment, it
would be advisable to create a master key with a more secure password.
Creating a certificate or asymmetric key
The backup encryption process will need to make use of a certificate or asymmetric
key to be able to take the backup. The following code creates a certificate that can be
used to back up your databases using encryption:
Use Master
GO
CREATE CERTIFICATE T3DBBackupCertificate
WITH SUBJECT = 'T3 Backup Encryption Certificate';
GO
Now you can take an encrypted backup of the database.
Creating an encrypted database backup
You can now take an encrypted backup of your databases. The following
Transact-SQL statements back up the T3 database using the certificate you
created in the preceding section:
BACKUP DATABASE t3
TO DISK = N'C:\Backup\t3_enc.bak'
WITH
COMPRESSION,
ENCRYPTION
(
 
Search WWH ::




Custom Search