Ola Hallengren script : Where to change backup frenquency?

  • Hello,

    Following the recommendations of this forum, I ended up installing Ola Hallengren scripts weeks ago.

    During install of I set up the deletion of the backup to be every 7 days. I would like now to change that to 4 days. How would I do that?

    I had a look at the sp_delete_bakcuphistory but only see that

    DECLARE @CleanupDate datetime

    SET @CleanupDate = DATEADD(dd,-30,GETDATE())

    EXECUTE dbo.sp_delete_backuphistory @oldest_date = @CleanupDate

     

    I presume the CleanupDate variable is to 30 days and not seven days like I asked... I am really not sure.

    Nic

  • Yes - its 30 days by default - SET @CleanupDate = DATEADD(dd,-30,GETDATE())

    You can change this to any day by changing the number.

    Ex: 4 Days - SET @CleanupDate = DATEADD(dd,-4,GETDATE())

     

    Muthukkumaran Kaliyamoorthy
    https://www.sqlserverblogforum.com/

  • jbeclapez wrote:

    Hello,

    Following the recommendations of this forum, I ended up installing Ola Hallengren scripts weeks ago.

    During install of I set up the deletion of the backup to be every 7 days. I would like now to change that to 4 days. How would I do that?

    I had a look at the sp_delete_bakcuphistory but only see that

    DECLARE @CleanupDate datetime

    SET @CleanupDate = DATEADD(dd,-30,GETDATE())

    EXECUTE dbo.sp_delete_backuphistory @oldest_date = @CleanupDate

    I presume the CleanupDate variable is to 30 days and not seven days like I asked... I am really not sure.

    Nic

    It looks like you're talking about 2 different things here. The first part of your post sounds like you are talking about how long to keep your backup files. But the next part refers to the backup history and not the files. If you are talking about how long to keep the .bak files, open the job, click on the Steps page, select the step and click Edit. The parameter @CleanupTime refers to the number of hours to retain old backup files. Change this to what you want and click OK and save the job.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply