DB2 Version 9.7 for Linux, UNIX, and Windows

db2HistoryData data structure

This structure is used to return information after a call to the db2HistoryGetEntry API.
Note: The language support for COBOL and FORTRAN has been deprecated for that API and might be discontinued in a future release. Use the following supported alternatives:
  • Build your application using C, C++, or Java™.
  • Access database history records by using the DB_HISTORY administrative view.
Table 1. Fields in the db2HistoryData structure
Field name Data type Description
ioHistDataID char(8) An 8-byte structure identifier and "eye-catcher" for storage dumps. The only valid value is SQLUHINF. No symbolic definition for this string exists.
oObjectPart db2Char The first 14 characters are a time stamp with format yyyymmddhhmmss, indicating when the operation was begun. The next 3 characters are a sequence number. Each backup operation can result in multiple entries in this file when the backup image is saved in multiple files or on multiple tapes. The sequence number allows multiple locations to be specified. Restore and load operations have only a single entry in this file, which corresponds to sequence number "001" of the corresponding backup. The time stamp, combined with the sequence number, must be unique.
oEndTime db2Char A time stamp with format yyyymmddhhmmss, indicating when the operation was completed.
oFirstLog db2Char The earliest log file ID (ranging from S0000000 to S9999999):
  • Required to apply rollforward recovery for an online backup
  • Required to apply rollforward recovery for an offline backup
  • Applied after restoring a full database or table space level backup that was current when the load started.
oLastLog db2Char The latest log file ID (ranging from S0000000 to S9999999):
  • Required to apply rollforward recovery for an online backup
  • Required to apply rollforward recovery to the current point in time for an offline backup
  • Applied after restoring a full database or table space level backup that was current when the load operation finished (will be the same as oFirstLog if roll forward recovery is not applied).
oID db2Char Unique backup or table identifier.
oTableQualifier db2Char Table qualifier.
oTableName db2Char Table name.
oLocation db2Char For backups and load copies, this field indicates where the data has been saved. For operations that require multiple entries in the file, the sequence number defined by oObjectPart parameter identifies which part of the backup is found in the specified location. For restore and load operations, the location always identifies where the first part of the data restored or loaded (corresponding to sequence "001" for multi-part backups) has been saved. The data in oLocation is interpreted differently, depending on oDeviceType parameter:
  • For disk or diskette (D or K), a fully qualified file name.
  • For tape (T), a volume label.
  • For TSM (A and F), the vendor library name/path that did the backup.
  • For user exit or other (U or O), free form text.
oComment db2Char Free form text comment.
oCommandText db2Char Command text, or DDL.
oLastLSN db2LSN Last log sequence number.
oEID Structure Unique entry identifier.
poEventSQLCA Structure Result sqlca of the recorded event.
poTablespace db2Char A list of table space names.
iNumTablespaces db2Uint32 Number of entries in the poTablespace list that are available for use by the db2HistoryGetEntry API.
oNumTablespaces db2Uint32 Number of entries in the poTablespace list that were used by the db2HistoryGetEntry API. Each table space backup contains one or more table spaces. Each table space restore operation replaces one or more table spaces. If this field is not zero (indicating a table space level backup or restore), the next lines in this file contain the name of the table space backed up or restored, represented by an 18-character string. One table space name appears on each line.
oOperation char See Table 2.
oObject char Granularity of the operation: D for full database, P for table space, and T for table.
oOptype char See Table 3.
oStatus char Entry status: A for active; I for inactive; E for expired; D for deleted; and X for do not delete.
oDeviceType char Device type. This field determines how the oLocation field is interpreted: A for TSM, C for client, D for disk, F for snapshot backup, K for diskette, L for local, O for other (for other vendor device support), P for pipe, Q for cursor, S for server, T for tape, and U for user exit.
Table 2. Valid oOperation values in the db2HistoryData structure
Value Description C definition COBOL/FORTRAN definition
A add table space DB2HISTORY_OP_ADD_TABLESPACE DB2HIST_OP_ADD_TABLESPACE
B backup DB2HISTORY_OP_BACKUP DB2HIST_OP_BACKUP
C load copy DB2HISTORY_OP_LOAD_COPY DB2HIST_OP_LOAD_COPY
D dropped table DB2HISTORY_OP_DROPPED_TABLE DB2HIST_OP_DROPPED_TABLE
F rollforward DB2HISTORY_OP_ROLLFWD DB2HIST_OP_ROLLFWD
G reorganize table DB2HISTORY_OP_REORG DB2HIST_OP_REORG
L load DB2HISTORY_OP_LOAD DB2HIST_OP_LOAD
N rename table space DB2HISTORY_OP_REN_TABLESPACE DB2HIST_OP_REN_TABLESPACE
O drop table space DB2HISTORY_OP_DROP_TABLESPACE DB2HIST_OP_DROP_TABLESPACE
Q quiesce DB2HISTORY_OP_QUIESCE DB2HIST_OP_QUIESCE
R restore DB2HISTORY_OP_RESTORE DB2HIST_OP_RESTORE
T alter table space DB2HISTORY_OP_ALT_TABLESPACE DB2HIST_OP_ALT_TBS
U unload DB2HISTORY_OP_UNLOAD DB2HIST_OP_UNLOAD
X log archive DB2HISTORY_OP_ARCHIVE_LOG DB2HIST_OP_ARCHIVE_LOG
Table 3. Valid oOptype values in the db2HistData structure
oOperation oOptype Description C/COBOL/FORTRAN definition
B F N I O D E offline, online, incremental offline, incremental online, delta offline, delta online DB2HISTORY_OPTYPE_OFFLINE, DB2HISTORY_OPTYPE_ONLINE, DB2HISTORY_OPTYPE_INCR_OFFLINE, DB2HISTORY_OPTYPE_INCR_ONLINE, DB2HISTORY_OPTYPE_DELTA_OFFLINE, DB2HISTORY_OPTYPE_DELTA_ONLINE
F E P end of logs, point in time DB2HISTORY_OPTYPE_EOL, DB2HISTORY_OPTYPE_PIT
G F N offline, online DB2HISTORY_OPTYPE_OFFLINE, DB2HISTORY_OPTYPE_ONLINE
L I R insert, replace DB2HISTORY_OPTYPE_INSERT, DB2HISTORY_OPTYPE_REPLACE
Q S U X Z quiesce share, quiesce update, quiesce exclusive, quiesce reset DB2HISTORY_OPTYPE_SHARE, DB2HISTORY_OPTYPE_UPDATE, DB2HISTORY_OPTYPE_EXCL, DB2HISTORY_OPTYPE_RESET
R F N I O R offline, online, incremental offline, incremental online, rebuild DB2HISTORY_OPTYPE_OFFLINE, DB2HISTORY_OPTYPE_ONLINE, DB2HISTORY_OPTYPE_INCR_OFFLINE, DB2HISTORY_OPTYPE_INCR_ONLINE, DB2HISTORY_OPTYPE_REBUILD
T C R add containers, rebalance DB2HISTORY_OPTYPE_ADD_CONT, DB2HISTORY_OPTYPE_REB
X N P M F 1 2 archive log command, primary log path, mirror log path, archive fail path, log archive method 1, log archive method 2 DB2HISTORY_OPTYPE_ARCHIVE_CMD, DB2HISTORY_OPTYPE_PRIMARY, DB2HISTORY_OPTYPE_MIRROR, DB2HISTORY_OPTYPE_ARCHFAIL, DB2HISTORY_OPTYPE_ARCH1, DB2HISTORY_OPTYPE_ARCH2
Table 4. Fields in the db2HistoryEID structure
Field name Data type Description
ioNode ioHID SQL_PDB_NODE_TYPE db2Uint32 Node number. Local database history records entry ID.

API and data structure syntax

typedef SQL_STRUCTURE db2HistoryData
{
   char ioHistDataID[8];
   db2Char oObjectPart;
   db2Char oEndTime;
   db2Char oFirstLog;
   db2Char oLastLog;
   db2Char oID;
   db2Char oTableQualifier;
   db2Char oTableName;
   db2Char oLocation;
   db2Char oComment;
   db2Char oCommandText;
   db2LSN oLastLSN;
   db2HistoryEID oEID;
   struct sqlca *poEventSQLCA;
   struct db2Char *poTablespace;
   db2Uint32 iNumTablespaces;
   db2Uint32 oNumTablespaces;
   char oOperation;
   char oObject;
   char oOptype;
   char oStatus;
   char oDeviceType;
} db2HistoryData;

typedef SQL_STRUCTURE db2Char
{
   char *pioData;
   db2Uint32 iLength;
   db2Uint32 oLength;
} db2Char;

typedef SQL_STRUCTURE db2HistoryEID
{
   SQL_PDB_NODE_TYPE ioNode;
   db2Uint32 ioHID;
} db2HistoryEID;

db2Char data structure parameters

pioData
A pointer to a character data buffer. If NULL, no data will be returned.
iLength
Input. The size of the pioData buffer.
oLength
Output. The number of valid characters of data in the pioData buffer.

db2HistoryEID data structure parameters

ioNode
This parameter can be used as either an input or output parameter. Indicates the node number.
ioHID
This parameter can be used as either an input or output parameter. Indicates the local database history records entry ID.