What are the challenges you face when working across database platforms? Take the survey

Deleting old backups from other server with Erase command

Tom_NLTom_NL Posts: 15
edited September 24, 2013 3:09AM in SQL Backup Previous Versions
In the past weeks we have moved all out SQL databases to new servers with SQL 2012. While moving our databases we also moved our old SQL backups to this new servers, because we always maintain a backup history of 45 days.

To remove backups older then 45 days we use a SQL agent job with the command

EXECUTE master..sqlbackup '-SQL "ERASE FULL_BACKUPS FOR [database name] FROM DISK = ''Local Path to backup folder]'' KEEP = 45 "'

We have used this job for ages, but on our new servers the job does not seem to delete any old SQLbackups, almost resulting in full harddisks

After a lot of debugging i found that the command only deletes files created by the server running the job. Probably it compares the servername with the servername from the backup header.
Because we moved the backups grom our old servers to the new servers, the backups originaly made by one of the old servers are not being deleted after 45 days.

I cannot find anything about this issue in the documentation, is this by design?
Is there a way to work around this behaviour?



Sign In or Register to comment.