Clean up Old Backup Files Failed with Encrypted BackupsPosted: March 4, 2016
The MaintenanceSolution is a great piece of T-SQL script from Ola Hallengren.
When I turn on the encryption for new backups, all backup files created are ignoring the command from xp_delete_file.
The reason is that this stored procedure is check file header to work with backup or log file it recognizes. It seems the encrypted version is not picked up so no cleanup happens and all encrypted backup files stay untouched.
Here is a sample code I copied from my system:
Exec [master].dbo.xp_delete_file 0, N’C:\Backup\myServerName\myDB\FULL_COPY_ONLY’, ‘bak’
One alternative solution:
To create an SSIS package with a powerhsell script to clean these old encrypted backup files and run as a scheduled job.