1

I am trying to find a way to delete backups being taken by Ola's native SQL backups. I am trying to keep only 14 days of transaction logs, 1 month of diffs, and 12 months of full weekend backups. Is there a way to do it in Ola's scripts?

  • That makes less sense, you know. Are you ok with only snapshots of data once a week (assuming you took FULLs every week)? Not having Logs past the month will effectively do that. – clifton_h Nov 30 '18 at 5:50
  • Im not the biggest fan of it, but those are the SLA'a outlined for us. I have tried to change it in vain for about 8 months now. – J1k0 Nov 30 '18 at 11:59
  • As long as you make it clear that recovery windows are not a full year but rather 14 days with snapshots occurring every week. In other words, they should understand that they only are asking for 14 days of real time backups. – clifton_h Nov 30 '18 at 14:08
  • How long between each log backup? say this is every four hours... do they understand that data loss retention is unavailable for the last 4 hours from current work? – clifton_h Nov 30 '18 at 14:13
  • An hour between the log backups. I have went through and explained this, but the customers really only go back further for reporting or to find issues. So I guess it ends up working. – J1k0 Nov 30 '18 at 14:42
1

You can use the CleanupTime parameter for each backup job (log, diff, full)

Specify the time, in hours, after which the backup files are deleted. If no time is specified, then no backup files are deleted.

So for example:

@Cleanuptime = 336  --2 weeks for transaction logs 
@Cleanuptime = 744  --1 month for diff backups 
@Cleanuptime = 8760 --1 year for full backups

Example A from Ola

A. Back up all user databases, using checksums and compression; verify the backup; and delete old backup files

EXECUTE dbo.DatabaseBackup
@Databases = 'USER_DATABASES',
@Directory = 'C:\Backup',
@BackupType = 'FULL',
@Verify = 'Y',
@Compress = 'Y',
@CheckSum = 'Y',
@CleanupTime = 24
  • Also you can add a expiration period on the backups and differentials so that the back up software does not assume it is available. But are you sure this will not remove the full backups? – clifton_h Nov 30 '18 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.