• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

SQL 2005 DB Backup Doesn't Remove Old Backup Copies

I used SQL Server Management Studio Maintenace Plan wizard to create a backup job that backs up a database nightly to a network location and is working as planned. My issue is that it creates a new .bak file with each backup (as I want it to) but after running for two weeks I have 14 .bak files. Is there an easy way to have the job also delete old .bak files that are older then 7 days?

I don't know any SQL scripting or coding so if there is a way to do this from the GUI that would be ideal.

Thanks in advance!
0
AIC-Admin
Asked:
AIC-Admin
  • 2
  • 2
1 Solution
 
Simone BSenior E-Commerce AnalystCommented:
In one of the first steps in the wizard you can select the tasks you want to configure. The one you're looking for is Maintenance cleanup.

capture.jpg
0
 
DcpKingCommented:
The .bak backup files are just files - they're not referred to in any database or anything - so you can just go to that directory and delete whichever ones you want to get rid of, using Windows Explorer!

You could add code into the backup maintenance plan (it's an SSIS package) to delete any files older than 7 days - is there someone in your organisation who writes SSIS packages?
0
 
AIC-AdminAuthor Commented:
I am sure that I could ask our SQL programmer to do write a SSIS package but I was trying to just finish the task myself. I know I can delete them via explorer but the idea is automation so I don't have to manually delete the files or worry about forgetting to clean them up and eating up disk space.

I will check the "Maintenance Cleanup Task" that buttercup1 suggested... I must have totally over looked that. Thanks
0
 
AIC-AdminAuthor Commented:
Since I already had the plan in place I just added a Subplan to run the Maintenance Cleanup Task and set it to delete files with extension bak from the network backup location that are older then 7 day(s). Thank you for the guidance!
0
 
Simone BSenior E-Commerce AnalystCommented:
You're welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now