Deleting backups when they are a week old.

  • I have a maintenance plan which does a full backup every day except Saturday and Sunday. Each backup has the name of the database and then the date of the backup appended to it every day. I have a maintenance cleanup task to search files in this folder with a .BAK extension and delete them if they are a week old. The maintenance plan is not deleting the backups at all. Is it because the date is appended to the backup? What do I need to do to delete the backup if it's older than a week?

    Should I use backup set will expire within the full backup maintenance plan?

  • I forgot to add that I am using sql 2005.

  • Make sure that you have not include the “.” in the file extension.

    Go thru this:

    http://www.sqlservercentral.com/Forums/Topic361562-149-1.aspx

    Manu

  • Can you use the Maintenance Cleanup Task?

  • Correct Erin, You Can use Cleanup task in SQL 2005. Make sure that .bak, .dif and .trn all should be seprate and schedule as the timeframe you required. 🙂

    Manoj

    MCP, MCTS (GDBA/EDA)

  • Wasn't there a problem with the Maint Plan Cleanup Task not working correctly ?? I think I heard that SP2 fixes that.

  • I have setup a new maintenance cleanup task in SP2 without any issues. The problem exists only while specifying the expiry of BackUp set while creating a new backup schedule job and not in the CleanUp task. Please check if the extension has been clearly specified alongwith the location/path of the backup files.

  • I removed the *.* Hopefully it will work now. If not I found a vb script that deletes old files. I also heard there was a problem with the maintenace plans. So, we'll see. THank you for your input.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply