Backup

如何為加密配置 Ola Hallengren 備份腳本

  • April 23, 2018

如何向 ola.hallengren 備份腳本添加加密。

簡而言之,我想實現這一目標

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  
Go

Ola Hallengren 的備份腳本文件中,他解釋了這些參數:

  • @Encrypt Y/N - Y 表示加密備份,N 是預設值
  • @EncryptionAlgorithm - 聽起來您正在尋找 AES_256,這是他支持的有效選項
  • @ServerCertificate - 所以你可以指定你想使用的

在頁面底部的範例中,有一個使用壓縮、加密和伺服器證書備份所有使用者數據庫的範例:

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'

引用自:https://dba.stackexchange.com/questions/204689