I'm trying to create a backup set which maintains only a fixed number of
days. As such, I've got the following script:
BACKUP DATABASE [mydb] to [mydb Backup Set] WITH NOINIT, NOUNLOAD,
NAME=N'My Database Backup', NOSKIP, STATS=10, NOFORMAT,
RETAINDAYS=5
DECLARE @i INT
select @i=position from msdb.backupset where database name='mydb'
and type!='F' amd backup set id=(select max(backupset set id) from
msdb.backupset where database name='mydb')
RESTORE VERIFYONLY FROM [mydb Backup Set] WITH FILE=@i
This script was created automatically, but I added the RETAINDAYS bit. I
only want the past five days of backups available, but when I check the
list, I've got backups dating back to December 2003! The older backups
are correctly being marked as expired, but they are still on the list!
How can I purge the list to only have the last five days of backups?
Thanks in advance
Johnny