snippetMinor
How to configure Ola Hallengren backup script for encryption
Viewed 0 times
scriptencryptionhallengrenforhowolaconfigurebackup
Problem
How can I add encryption to ola.hallengren backup script.
In short i want to achieve this
In short i want to achieve this
BACKUP DATABASE [MyTestDB]
TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\MyTestDB.bak'
WITH
COMPRESSION,
ENCRYPTION
(
ALGORITHM = AES_256,
SERVER CERTIFICATE = MyTestDBBackupEncryptCert
),
STATS = 10
GoSolution
In the documentation for Ola Hallengren's backup scripts, he explains these parameters:
At the bottom of the page, in the examples, there's an example to back up all user databases with compression, encryption, and a server certificate:
So based on my extensive research and a good thirty seconds of reading, it would be:
- @Encrypt Y/N - Y means encrypt the backup, N is the default
- @EncryptionAlgorithm - sounds like you're looking for AES_256, which is a valid option that he supports
- @ServerCertificate - so you can specify the one you want to use
At the bottom of the page, in the examples, there's an example to back up all user databases with compression, encryption, and a server certificate:
EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES',
@Directory = 'C:\Backup',
@BackupType = 'FULL',
@Compress = 'Y',
@Encrypt = 'Y',
@EncryptionAlgorithm = 'AES_256',
@ServerCertificate = 'MyCertificate'So based on my extensive research and a good thirty seconds of reading, it would be:
EXECUTE dbo.DatabaseBackup @Databases = 'MyTestDB',
@Directory = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\',
@BackupType = 'FULL',
@Compress = 'Y',
@Encrypt = 'Y',
@EncryptionAlgorithm = 'AES_256',
@ServerCertificate = 'MyTestDBBackupEncryptCert'Code Snippets
EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES',
@Directory = 'C:\Backup',
@BackupType = 'FULL',
@Compress = 'Y',
@Encrypt = 'Y',
@EncryptionAlgorithm = 'AES_256',
@ServerCertificate = 'MyCertificate'EXECUTE dbo.DatabaseBackup @Databases = 'MyTestDB',
@Directory = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\',
@BackupType = 'FULL',
@Compress = 'Y',
@Encrypt = 'Y',
@EncryptionAlgorithm = 'AES_256',
@ServerCertificate = 'MyTestDBBackupEncryptCert'Context
StackExchange Database Administrators Q#204689, answer score: 5
Revisions (0)
No revisions yet.