SQL SERVER – Maintenance Plan – Backup Files Not Getting Deleted

Sometimes it is important to read the documentation before assuming things based on the text. This blog is the result of one of my quick interaction with a client who had an issue with Maintenance Plan which they created for backup files.

Pinal,
We are having issues with a maintenance plan. We have created plans to take log backup every 15 mins and configured it in such a way that it deletes the backup. The maintenance plan is running fine, but backups are not getting deleted. Do you have any ideas?

Within a few minutes, I replied to my blog which I wrote on similar behavior. SQL SERVER – Maintenance Plan – Maintenance Cleanup Task not Deleting Files

Their response made me laugh.

Pinal,
We have gone through the blog, but we are not using clean task. We have selected maintenance plan with the option “backup set will expire” to delete the old backup files. Do you think it’s a bug?

I replied with a one liner.

Backup set will expire”, means an expiration date to indicate when the backup set can be overwritten by another backup not that the file/data is removed.

SQL SERVER - Maintenance Plan - Backup Files Not Getting Deleted mp-clean-01

Please use a cleanup task to achieve what you want.

SOLUTION/WORKAROUND

To remove old backup files, we need to use maintenance plan cleanup task (refer my earlier blog). We might need to create two tasks. One to clean up the backup files and other to cleanup maintenance plan reports.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

Maintenance Plan, SQL Backup, SQL Server
Previous Post
SQL Azure Database – Msg 40197, Level 20 – The Service has Encountered an Error Processing Your Request. Please Try Again. Error Code 40549
Next Post
SQL SERVER – My Thoughts – Autogrow of File ‘SQLAuth_Log’ in Database ‘SQLAuth’ was Cancelled by User or Timed Out After 30020 Milliseconds

Related Posts

2 Comments. Leave new

  • The expanded content of your “Solution/Workaround” would make a lovely follow-up post (please!)… I doubt my current approach is anywhere near what you would approve

    Reply
  • Hi Pinal, I have used the same cleanup task to clear the sql audit fiels, even I tried to give the sql service account full access privilege on the folder as well. But it clearing the .sqlaudit files. The files I am trying to delete is not in use as well. The small files I moved already to another archive directory as well. What could be the reason.

    Reply

Leave a Reply