• 2 replies
  • Latest Post - ‏2014-02-13T20:35:59Z by Luke Numrych
1 Post

Pinned topic Db2 9.5 delete old DB backup image

‏2014-02-09T15:46:52Z |

Hi brother,

we would like to delete old backup image on locate disk, can I use unix command to delete directly like 'rm' or I need connect to db2 then use SQL command to delete the old db backup image?



  • Kelly Rodger
    Kelly Rodger
    8 Posts

    Re: Db2 9.5 delete old DB backup image


    John, you can delete DB2 backup images directly yourself if they're on local filesystems.  That's not usually a problem, unless the image is part of a set of incremental or delta images, in which case proceed with great caution.  If there's ever a chance that you'll use any of the automated recovery capabilities, such as the RECOVER command, a RESTORE REBUILD, or an automatic incremental restore, as a few examples, then it's a good idea to also update the database history records of those backup images to mark the images as deleted.

    UPDATE HISTORY FOR 20140212010900001 WITH STATUS D

    Better yet, have you looked at the AUTO_DEL_REC_OBJ database configuration parameter, which can automatically clean up old images for you based on retention settings that you specify, so you don't have to worry about any of this.

    Hope that helps

    Kelly Rodger

  • Luke Numrych
    Luke Numrych
    118 Posts

    Re: Db2 9.5 delete old DB backup image


    I like to use PRUNE HISTORY AND DELETE in conjunction with AUTO_DEL_REC_OBJ in these instances where I have to manually remove backup files.  The goal though is to let DB2 manage pruning of recovery objects (backup and log files).  See auto_del_rec_obj, num_db_backups, and rec_hist_retentn.