deleting backup files

  • i have a maintenance plan with subtasks to first delete the old backup greater than one day and then take backup..i am little confused while deleting old backup file does it check the time when the backup was started or finished?...please clarify..thanks,,

  • It uses the last modified time of the file - and deletes any files older than the criteria you set at the time the task runs.

    I would not recommend deleting the prior backup before performing the current backup. What would happen if the current backup failed? You wouldn't have the prior backup available anymore (at least not online, cause you do have it on tape - don't you?).

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

  • hmm..well the backups are now not written to the tape..but they will eventually very soon...and if the backups fail anyhow the delete task wont execute..? i could be wrong..thanks..

  • If you have the delete task execute before the backup - the files will be deleted and then the backup will run. If the backup then fails, you've lost your online version of the backups.

    If you have the backup task first - and finish with the delete task only if the backup task is successful, then you will have a current backup before you delete the prior backups.

    It's just a matter of the order you set the tasks up.

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Jeffrey Williams (4/15/2009)


    If you have the delete task execute before the backup - the files will be deleted and then the backup will run. If the backup then fails, you've lost your online version of the backups.

    If you have the backup task first - and finish with the delete task only if the backup task is successful, then you will have a current backup before you delete the prior backups.

    It's just a matter of the order you set the tasks up.

    backup creation and deletion of old backups have same schedule in maintenance plan.

    DBDigger Microsoft Data Platform Consultancy.

  • Shehzad do u think old backups will be deleted if the backup fails?.i will actually test it today thanks,

  • As it is given there without any associated condition that 'delete files older than X days.', so i think older files will be deleted in case of failure. But let us wait for your test environment result and please share it here.

    DBDigger Microsoft Data Platform Consultancy.

  • The schedule has nothing to do with the deleting of the backup files. The schedule only determines when the maintenance plan starts.

    i have a maintenance plan with subtasks to first delete the old backup greater than one day and then take backup

    Presuming that you have joined these tasks via a success, or completion constraint, the first task will delete any files older than one day, as per your settings, then the next task, which is a backup, will start.

    As pointed out by Jeffrey Williams, this is not something you want to be doing. The delete files task should be after the backup task and it should be linked via a success constraint. That way if the backup fails, no files will be deleted.

    If you don't have enough space to backup the database without deleting the previous backup first, then allocate more disk space to the server, or move the backup file off to another server.

    --------------------
    Colt 45 - the original point and click interface

  • I'm second'ing, or thirding the advice above. DO NOT delete backup files before the next backup is written. If you're out of space, get more. Any manager that wants his data protected will get more.

    You might also consider copying these files (using scripting) to another server, and deleting them from there once they're on tape.

  • thanks for replying..im deleting backups older than 2 days...so any how iw ill be having 2 days of backups..do u still think there would be an issue if delete task is first and then backup?

  • The issue is if your backup fails for some reason. If you've deleted backups and the current backup has issues, you might not be able to recover. I know you're going 2 days back, but it's a poor process to use.

    Backup first, then delete.

  • Yes - all it will take is a single weekend where you don't get the notifications of the job failures and you will no longer have any backups available online.

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

  • thanks...i will work on this...

  • Your backup logic should look like:

    Step #1

    Take Backup

    On success go to Step #2

    On failure send alert and abort!

    Step #2

    Delete old backup files older than N days

    On sucess finish

    On failure send alert

    😉

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 14 posts - 1 through 13 (of 13 total)

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