October 31, 2019 at 7:21 am
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
October 31, 2019 at 10:40 am
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/
October 31, 2019 at 11:31 am
You can have look on this as well - https://www.sqlserverblogforum.com/dba/how-to-use-configure-ola-hallengren-sql-server-maintenance-script/
Muthukkumaran Kaliyamoorthy
https://www.sqlserverblogforum.com/
November 8, 2019 at 5:06 pm
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