Automatically delete old backup dumps

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • snoconegod@gmail.com

    #1

    Automatically delete old backup dumps

    Hi all,

    This one's probably super easy and I'm just not finding the right
    command/job:

    I've already set up a scheduled backup job that dumps the contents of
    my DB2 (ver 8.1) database to a folder on my hard drive nightly (it is
    then backed up on a tape). However, I have no idea how to
    automatically delete old backup dump files (I've been doing it
    manually each morning). MS-SQL 2000 and 2005 are pretty
    straightforward with their wizards, but I'm not seeing anything in
    DB2. Where do I go?

    Thanks!
    John

  • Lennart

    #2
    Re: Automatically delete old backup dumps

    On Mar 6, 5:00 pm, snocone...@gmai l.com wrote:
    Hi all,
    >
    This one's probably super easy and I'm just not finding the right
    command/job:
    >
    I've already set up a scheduled backup job that dumps the contents of
    my DB2 (ver 8.1) database to a folder on my hard drive nightly (it is
    then backed up on a tape). However, I have no idea how to
    automatically delete old backup dump files (I've been doing it
    manually each morning). MS-SQL 2000 and 2005 are pretty
    straightforward with their wizards, but I'm not seeing anything in
    DB2. Where do I go?
    >
    Thanks!
    John
    Use the scheduler in your OS and remove backups older than ? days. If
    you are on Unix/Linux, lookup crontab and find ( -ctime -name ). Not
    sure about windows, but if not possible you can always use cygwin.

    Another option is if you can manipulate the script that starts tha
    backup to tape. After a successfull tapebackup, remove the backup.

    /Lennart

    Comment

    • Mark A

      #3
      Re: Automatically delete old backup dumps

      "Lennart" <Erik.Lennart.J onsson@gmail.co mwrote in message
      news:1173199954 .312417.174310@ s48g2000cws.goo glegroups.com.. .
      Use the scheduler in your OS and remove backups older than ? days. If
      you are on Unix/Linux, lookup crontab and find ( -ctime -name ). Not
      sure about windows, but if not possible you can always use cygwin.
      >
      Another option is if you can manipulate the script that starts tha
      backup to tape. After a successfull tapebackup, remove the backup.
      >
      /Lennart
      It is somewhat dangerous to automatically remove backups older than n days
      old, because if for some reason your backups have been failing for awhile,
      you could end up with no backups. It would be better to remove old backups
      past a certain date only if there are a certain number of backups already
      existing in the directory.

      Perhaps someone can volunteer a script that can do it (with both date and
      number of backups as the criteria for deletes).


      Comment

      • j_ammann@yahoo.com

        #4
        Re: Automatically delete old backup dumps

        On 7 Mrz., 00:57, "Mark A" <nob...@nowhere .comwrote:
        "Lennart" <Erik.Lennart.J ons...@gmail.co mwrote in message
        >
        news:1173199954 .312417.174310@ s48g2000cws.goo glegroups.com.. .
        >
        Use the scheduler in your OS and remove backups older than ? days. If
        you are on Unix/Linux, lookup crontab and find ( -ctime -name ). Not
        sure about windows, but if not possible you can always use cygwin.
        another option:
        if you use "automatic maintenance" on the database db2 take's care of
        it (backup up the db to a given directory and remove old backups)
        control-center (right click on DB, --configure automatic
        maintenance)

        Comment

        • Pierre Saint-Jacques

          #5
          Re: Automatically delete old backup dumps

          Your db cfg has a parm. NUM_DBBACKUPS=1 2 (default). This number tells DB2
          to keep track of all backup images (12) in the Recovery History File (db2
          List history BACKUP All, verify the command).
          You can then use the DB2 PURGE command to tell DB2 to clean up older
          references to the images. It does not clean them up.
          You could then look at the history file and see what is the oldest image
          tracked there and physically with a script remove, delete, purge, whatever
          the older than that images.
          If you read your docs. about that purge command and also use a db2exit or
          logarchmeth parm., the purge will also clean up the logs associated with
          those.

          My db is: (NUM_DB_BACKUPS ) = 3 and (REC_HIS_RETENT N) = 90
          This means that the Rec. Hist File is self-pruning on the 90th day from
          today and cleans the references, not the images, for all backups older than
          90 days that are outside of the timestamp of the last 3 images.
          Once in a while, I'll got to the backuo targets and physically remove the
          older images. The db is not critical and this works for me but you can see
          how easy it would be to tailor a script from there.
          HTH, Pierre.
          --
          Pierre Saint-Jacques
          SES Consultants Inc.
          514-737-4515
          "Lennart" <Erik.Lennart.J onsson@gmail.co ma écrit dans le message de news:
          1173199954.3124 17.174310@s48g2 00...legr oups.com...
          On Mar 6, 5:00 pm, snocone...@gmai l.com wrote:
          >Hi all,
          >>
          >This one's probably super easy and I'm just not finding the right
          >command/job:
          >>
          >I've already set up a scheduled backup job that dumps the contents of
          >my DB2 (ver 8.1) database to a folder on my hard drive nightly (it is
          >then backed up on a tape). However, I have no idea how to
          >automaticall y delete old backup dump files (I've been doing it
          >manually each morning). MS-SQL 2000 and 2005 are pretty
          >straightforwar d with their wizards, but I'm not seeing anything in
          >DB2. Where do I go?
          >>
          >Thanks!
          >John
          >
          Use the scheduler in your OS and remove backups older than ? days. If
          you are on Unix/Linux, lookup crontab and find ( -ctime -name ). Not
          sure about windows, but if not possible you can always use cygwin.
          >
          Another option is if you can manipulate the script that starts tha
          backup to tape. After a successfull tapebackup, remove the backup.
          >
          /Lennart
          >

          Comment

          Working...