February 11, 2009 at 12:00 pm
Hi everyone,
Here's my question
I Want to setup job to delete backup files on particular path older than n days from SQL Server 2000 Server
February 11, 2009 at 12:36 pm
Are you using the built-in Database Maintenance Plan feature to make these backups ?
If so, on the "Complete backup" or "Transaction log backup" sheet of the maintenance plan, simply check the "Remove files older than" option, specify a time interval in Minutes, Hours, Days, Weeks or Months - and the backup job itself will take care of this for you.
Note that the check for old files - and their possible deletion - only happens after a successful backup, so if your backup fails for some reason, none of the older files will be deleted - even if their age suggests that they should be. This is actually an intentional precaution from Microsoft's side: You wouldn't want your failed job to delete the last good backup just before something really bad happened, would you??
On the other hand, if disk space is an issue on your server, this can lead to annoying situations where your backup job can't make a new backup set because the old files aren't cleaned up, while at the same time it can't clean up old files because it couldn't make a new backup set!
Therefore, when using disk to store backups, it is especially important to pay close attention to your disk capacity.
Vegard Hagen
Norwegian DBA, occasional blogger and generally a nice guy who believes the world is big enough for all of us.
@vegard_hagen on Twitter
Blog: Vegards corner (No actual SQL stuff here - havent found my niche yet. Maybe some day...)
February 11, 2009 at 1:06 pm
Thanks for your reply.
But here's the problem. For some databases we are doing differential backups through scripts not with the maintenance plan and those dbs are very big thus consuming a lot of space on server.
Is there any other way we can delete older files?
Thanks.
February 11, 2009 at 5:55 pm
Check Example 1: VBScript to delete files in a folder that are certain days old
under
http://www.sqlservercentral.com/articles/Administering/usingvbscripttoautomatetasks/1171/
MJ
February 12, 2009 at 3:18 pm
Thanks a lot Manu....That really worked..
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply