January 16, 2013 at 1:01 pm
If I have the following:
SET @deleteday= dateadd(dd,-3,getdate())
EXEC msdb.dbo.sp_delete_backuphistory @deleteday
In the folder, currently have backups for 01/13/2013, 01/14/2013, 01/15/2013
So when the job runs, it'll delete 01/13/2013 backup from the folder.
Scenario
If I change the day from -3 to -4 before the clean up job runs tonight, the job won't delete 01/13/2013 because it's looking for 01/12/2013.
From @deleteday= dateadd(dd,-3,getdate())
To @deleteday= dateadd(dd,-4,getdate())
And if I change the day tomorrow back from -4 to -3
From @deleteday= dateadd(dd,-4,getdate())
To @deleteday= dateadd(dd,-3,getdate())
it'll essentially be looking for 1/14/2013.
My question is, will it delete 1/13/2013 AND 1/14/2013 backups? Or will it just delete 1/14/2013 backup and keep the 1/13/2013?
Thanks!
January 17, 2013 at 1:20 am
It will delete both.
The parameter you are passing to sp_delete_backuphistory is telling it to delete ALL backup history OLDER than that date.
January 17, 2013 at 4:37 am
sp_delete_backuphistory deletes backup history from the MSDB backup history tables, it doesnt touch the filesystem!!
You're referring to xp_delete_file to achieve this
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply