DB2 Version 9.7 for Linux, UNIX, and Windows

Rebuilding partitioned databases

To rebuild a partitioned database, rebuild each database partition separately. For each database partition, beginning with the catalog partition, first restore all the table spaces that you require. Any table spaces that are not restored are placed in restore pending state. Once all the database partitions are restored, you then issue the ROLLFORWARD DATABASE command on the catalog partition to roll all of the database partitions forward.

About this task

Note: If, at a later date, you need to restore any table spaces that were not originally included in the rebuild phase, you need to make sure that when you subsequently roll the table space forward that the rollforward utility keeps all the data across the database partitions synchronized. If a table space is missed during the original restore and rollforward operation, it might not be detected until there is an attempt to access the data and a data access error occurs. You will then need to restore and roll the missing table space forward to get it back in sync with the rest of the partitions.

To rebuild a partitioned database using table-space level backup images, consider the following example.

In this example, there is a recoverable database called SAMPLE with three database partitions:

The following backups have been taken, where BKxy represents backup number x on partition y:

The following procedure demonstrates using the RESTORE DATABASE and ROLLFORWARD DATABASE commands, issued through the CLP, to rebuild the entire database to the end of logs.

Procedure

  1. On database partition 1, issue a RESTORE DATABASE command with the REBUILD option:
       db2 restore db sample rebuild with all tablespaces in database 
          taken at BK31 without prompting
  2. On database partition 2, issue a RESTORE DATABASE command with the REBUILD option:
       db2 restore db sample rebuild with tablespaces in database 
          taken at BK42 without prompting
  3. On database partition 3, issue a RESTORE DATABASE command with the REBUILD option:
       db2 restore db sample rebuild with all tablespaces in database 
          taken at BK43 without prompting
  4. On the catalog partition, issue a ROLLFORWARD DATABASE command with the TO END OF LOGS option:
       db2 rollforward db sample to end of logs
  5. Issue a ROLLFORWARD DATABASE command with the STOP option:
       db2 rollforward db sample stop

What to do next

At this point the database is connectable on all database partitions and all table spaces are in NORMAL state.