I'm trying to modify a backup script so that it will keep 2 days of backups. My latest change allowed it to keep 2 days, but it's not deleting the older backups after they expire. (that means it's keeping things that are 3 and 4 days old...that starts to eat disk space REAL fast)
NOTE: I'm storing all of the backups (full and transaction log) in a backup device.
Here's the script I'm call for the full backup:
BACKUP DATABASE c2000
DESCRIPTION = 'Full'
, RETAINDAYS = 2
, NAME = 'Daily Backup'
, STATS = 5
It should be related to the retaindays, INIT/NOINIT, and SKIP/NOSKIP parameters...but it's not doing what I expect it to do.
init and noinit govern whether the file is overwritten or appended to respectively. If this is a disk device, then the file will simply grow over time. The retaindays parameter (after reading the description) must populate the either the header of the backup device, or a field in msdb as to when the device is available to be overwritten.