Deleting database recovery objects using the PRUNE HISTORY command or the db2Prune API

You can use the auto_del_rec_obj database configuration parameter and the PRUNE HISTORY command or the db2Prune API to delete recovery objects.

About this task

When you invoke the PRUNE HISTORY command, or call the db2Prune API, the IBM® Data Server database manager does the following:

  • Prunes entries from the recovery history file that do not have the status DB2HISTORY_STATUS_DO_NOT_DEL

When you invoke the PRUNE HISTORY command with the AND DELETE parameter, or when you call the db2Prune API with the DB2PRUNE_OPTION_DELETE flag, the database manager does the following:

  • Prunes entries from the recovery history file that are older than a timestamp you specify and that do not have the status DB2HISTORY_STATUS_DO_NOT_DEL

  • Deletes the physical log files associated with the pruned entries

If you set the auto_del_rec_obj database configuration parameter to ON, then when you invoke the PRUNE HISTORY command with the AND DELETE parameter, or when you call the db2Prune API with the DB2PRUNE_OPTION_DELETE flag, the database manager does the following:

  • Prunes entries from the recovery history file that do not have the status DB2HISTORY_STATUS_DO_NOT_DEL

  • Deletes the physical log files associated with the pruned entries

  • Deletes the backup images associated with the pruned entries

  • Deletes the load copy images associated with the pruned entries

Procedure

To delete unneeded recovery objects:

  1. Set the auto_del_rec_obj database configuration parameter to ON.
  2. Invoke the PRUNE HISTORY command with the AND DELETE parameter, or call the db2Prune API with the DB2PRUNE_OPTION_DELETE flag.