SQL Server 2005 Maintenance Plan not deleting old backups

  • I created a Maintenance Plan to do a nightly full backup and set the backup set to expire after 2 days.

    Weeks later, old backups are sitting on the hard drive in the installation directory and I have to manually delete them.  Here is a screen shot of what the plan looks like

    What am I doing wrong?

  • Hi Brent

     

    Make sure that you have not include the “.” in the file extension.  Also make sure that you select the correct folder and don’t use the “Include first-level subfolders” option, I have found that creating a separate cleanup task for each folder tends to work better.

     

    If it still does not work try running a profiler trace to capture the actual command being executed when the job runs, this may give you a better idea of why the files are not being deleted.

     

    Ps. What version and SP level of SQL are you using?

     

    Regards

     

  • I'm using v 2005, SP2.  And, why doesn't "Backup Set will expire after 2 days" mean "Backup set will expire after 2 days?"  The screen shot shows there is no period before "bak".

  • The "Backup set will expire" option just indicates for how many days SQL will be prevented from overwriting the backup set.

     

    Another thing you can try is to open up you maintenance plan, right-click on the maintenance cleanup task and click edit.  Then click on the view T-SQL button.  This will show you the actual T-SQL which will be executed, you can then past this into a query window and try to track down the problem.

     

    PS. The screen shot image is not displaying for some reason?

  • Okay, I think that fixed it.  I didn't realize that was a separate task.

  • Hi,

    I dont have the option like"include first level folders", am using SQL 2005 with out SP.Will SP will fix it?

    Regards,

    Arun

  • thanks for this~! been banging my head why my backups are not being deleted. I had the period in front of the files extension.

  • THANK YOU! I had a "." in my file extension that was preventing my backups from being deleted. THANKS!

    Erin

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

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