UPDATE HISTORY command

The UPDATE HISTORY command updates the location, device type, comment, or status in a database history records entry.

Authorization

One of the following authorities:
  • SYSADM
  • SYSCTRL
  • SYSMAINT
  • DBADM

Required connection

Database

Command syntax

Read syntax diagramSkip visual syntax diagramUPDATE HISTORYFORobject-partEIDeidWITHLOCATIONnew-locationDEVICE TYPEnew-device-typeCOMMENTnew-commentSTATUSnew-status

Command parameters

FOR object-part
Attention: With the release of Db2® 12.1, the UPDATE HISTORY FOR object-part command parameter is deprecated and might be removed in a future release.
Specifies the identifier for the history entry to be updated. It is a time stamp with an optional sequence number from 001 to 999. For history entries, such as backups, that make use of the sequence number, if the sequence number is not included in the object-part, the default sequence number 001 will be used. That is, if there are history entries with the same time stamp but different sequence numbers, and only the time stamp is used as the object-part, the UPDATE HISTORY command will only update the matching entry with sequence number 001.

This parameter cannot be used to update the entry status. To update the entry status, specify an EID instead.

EID eid
Specifies the history entry ID.
LOCATION new-location
Specifies the new physical location of a backup image. The interpretation of this parameter depends on the device type.
DEVICE TYPE new-device-type
Specifies a new device type for storing the backup image. Valid device types are:
D
Disk
A
Tivoli® Storage Manager
F
Snapshot backup
f
Snapshot backup that was generated by a custom script.
U
User exit
P
Pipe
N
Null device
Q
SQL statement
O
Other
COMMENT new-comment
Specifies a new comment to describe the entry. If connected to Db2 12.1 database or later, and the EID is specified for the history entry to be updated, the maximum size for the new-comment is 254 ASCII characters. Otherwise, the size of the new-comment cannot exceed 30 ASCII characters.
STATUS new-status
Specifies a new status for an entry. Only backup entries can have their status updated. Valid values are:
A
Active. The backup image is on the active log chain. Most entries are active.
I
Inactive. Backup images that no longer correspond to the current log sequence, also called the current log chain, are flagged as inactive.
E
Expired. Backup images that are no longer required, because there are more than NUM_DB_BACKUPS active images, are flagged as expired.
D
Deleted. Backup images that are no longer available for recovery should be marked as having been deleted.
X
Do not delete. Marking database history record entries with the DB2HISTORY_STATUS_DO_NOT_DELETE status prevents them from being pruned by any of the following methods:
  • Calls to the PRUNE HISTORY command.
  • By running the ADMIN_CMD procedure with the PRUNE HISTORY option.
  • By calls to the db2Prune API.
  • By automated database history file pruning.
Use the DB2HISTORY_STATUS_DO_NOT_DELETE status to protect key database history record entries from being pruned and the recovery objects associated with them from being deleted. For Db2 versions prior to 11.5.9, only log files, backup images, and load copy images can be marked as DB2HISTORY_STATUS_DO_NOT_DELETE.

Example

The object-part of a backup database history record entry consists of a 14 digit time stamp associated to the backup image and a 3 digit sequence number of this backup image. To update the database history record entries for a full database backup taken to 2 target devices on April 13, 1997 at 10:00 a.m., enter:
db2 update history for 19970413100000001 with location /backup/dbbackup.1 device type D
db2 update history for 19970413100000002 with location /backup/dbbackup.2 device type D

Usage notes

The primary purpose of the database history records is to record information, but the data contained in the history is used directly by automatic restore operations. During any restore where the AUTOMATIC option is specified, the history of backup images and their locations will be referenced and used by the restore utility to fulfill the automatic restore request. If the automatic restore function is to be used and backup images have been relocated since they were created, it is recommended that the database history record for those images be updated to reflect the current location. If the backup image location in the database history is not updated, automatic restore will not be able to locate the backup images, but manual restore commands can still be used successfully.