Backup and recovery resources and tools
Db2 relies on the log and the BSDS to record data changes as they occur. The log and BSDS provide critical information during recovery. Other important tools that you need for backup and recovery of data are several of the Db2 utilities.
Using the log for backup and recovery
The Db2 log registers data changes and significant events as they occur. Db2 writes each log record to the active log, which is a disk data set. When the active log data set is full, Db2 copies its contents to the archive log, which is a disk or a tape data set. This process is called offloading.
The archive log can consist of up to 10000 data sets. Each archive log is a sequential data set (physical sequential) that resides on a disk or magnetic tape volume.
With Db2, you can choose either single logging or dual logging. A single active log contains up to 93 active log data sets. With dual logging, Db2 keeps two identical copies of the log records. Dual logging is the better choice for increased availability.
Using the bootstrap data set for backup and recovery
The bootstrap data set (BSDS) is a repository of information about the data sets that contain the log. The BSDS contains the following information:
- An inventory of all active and archive log data sets that are known to Db2.
Db2 records data about the log data set in the BSDS each time a new archive log data set is defined or an active log data set is reused. The BSDS inventory includes the time and date that the log was created, the data set name, its status, and other information. Db2 uses this information to track the active and archive log data sets. Db2 also uses this information to locate log records for log read requests that occur during normal Db2 subsystem activity and during restart and recovery processing.
- An inventory of all recent checkpoint activity that Db2 uses during restart processing.
- A distributed data facility (DDF) communication record.
- Information about buffer pools.
Because the BSDS is essential to recovery in the event of a subsystem failure, Db2 automatically creates two copies of the BSDS during installation. If possible, Db2 places the copies on separate volumes.
Db2 utilities that support backup and recovery
The following utilities are commonly used for backup and recovery:
- COPY, QUIESCE, MERGECOPY, and BACKUP SYSTEM for backup
- RECOVER, REBUILD INDEX, REPORT, and RESTORE SYSTEM for recovery
In general, you use these utilities to prepare for recovery and to restore data. Each utility plays a role in the backup and recovery process.
- COPY
- The COPY utility creates up to four image copies of table spaces, indexes, and data sets. The two types of image copies are as follows:
- Full image copy: A copy of all pages in a table space, partition, data set, or index space.
- Incremental image copy: A copy of only the table space pages that have changed since the last use of the COPY utility.
While COPY is running, you can use a SHRLEVEL option to control whether other programs can access or update the table space or index.- SHRLEVEL REFERENCE gives other programs read-only access.
- SHRLEVEL CHANGE allows other programs to change the table space or index space.
In general, the more often that you make image copies, the less time that recovery takes. However, if you make frequent image copies, you also spend more time making copies.
The RECOVER utility uses these copies when recovering a table space or index space to the most recent point in time or to a previous point in time. The catalog table SYSIBM.SYSCOPY records information about image copies.
- QUIESCE
- The QUIESCE utility establishes a single point of consistency, called a quiesce point, for one or more page sets. To establish regular recovery points for subsequent point-in-time recovery, you must run QUIESCE frequently between regular executions of COPY.
- MERGECOPY
- The MERGECOPY utility merges image copies that the COPY utility produced or inline copies that the LOAD or REORG utilities produced. MERGECOPY can merge several incremental copies of a table space to make one incremental copy. It can also merge incremental copies with a full image copy to make a new full image copy.
- BACKUP SYSTEM
- The online BACKUP SYSTEM utility invokes z/OS DFSMShsm (Version 1.5 or later). BACKUP SYSTEM copies the volumes on which the Db2 data and the Db2 log information reside for a non-data sharing Db2 subsystem or a Db2 data sharing group.
- RECOVER
- The RECOVER utility recovers data to the current state or to a previous point in time by restoring a copy, and then by applying log records.
- REBUILD INDEX
- The REBUILD INDEX utility reconstructs indexes from the table that they reference.
- REPORT
- The REPORT utility provides information that is needed to recover a table space, an index, or a table space and all of its indexes. You can also use the REPORT utility to obtain recovery information about the catalog.
- RESTORE SYSTEM
- The online RESTORE SYSTEM utility invokes z/OS DFSMShsm (Version 1.5 or later). RESTORE SYSTEM uses data that is copied by the BACKUP SYSTEM utility.
Db2 Tools for z/OS products that support backup and recovery
You can also use the following IBM® Db2 Tools for z/OS in various backup and recovery situations:
- Application Recovery tool for IMS and Db2 Databases
- A tool that simplifies and coordinates the recovery of both IMS and Db2 data to a common point, reducing the time and cost of data recovery and availability.
- Db2 Archive Log Accelerator
- A tool that reduces the overhead that is associated with database log management to balance the increases in archive log growth.
- Db2 Change Accumulation Tool for z/OS
- A tool that quickly restores database objects with precision and minimal disruption, setting the scope and specificity of image copy creation through the use of control cards.
- Db2 Log Analysis Tool for z/OS
- A tool that provides you with a powerful tool to ensure high availability and complete control over data integrity. This tool allows you to monitor data changes by automatically building reports of changes that are made to database tables.