Restore and roll forward through a topology change

A topology change involves adding or dropping members from a Db2 pureScale® instance, either explicitly by running a db2iupdt operation or through a restore operation. Certain conditions need to exist before restoring a backup image and successfully rolling-forward when there is a topology difference between the source image and target instance.

Conditions for successful restore operations when topologies are different

If a backup image is being restored to the instance from which it was taken, but the instance has undergone a topology change, you can still restore into the target instance. You just need to have a common pureScale member in both your backup image and your target instance. You can also restore into a different instance.

To run a rollforward operation, followed by a restore operation, all of the members in the source topology must exist in the target topology.

When rolling forward is not supported, the restore operation must be done by using an offline backup image with the WITHOUT ROLLING FORWARD option. An online backup image is not supported in these cases because the option cannot be specified with an online backup image. Alternatively, restore and rollforward can be done on another instance that has all of the members from the source topology.

Table 1. Supported restore and rollforward scenarios when dealing with different database topologies
Scenario Example source topology Example target topology Restore supported Rollforward supported
Target topology has members that are not in the source image. Two-member pureScale (member 0, 1) Three-member pureScale (member 0, 1, 2) Yes Yes
Target topology is missing members that are in the source image. Three-member pureScale (member 0, 1, 2) Two-member pureScale (member 0, 1) Yes, but must be an offline image with the WITHOUT ROLLING FORWARD option set. No
Target topology has members that are not in the source image and is missing members that are in the source image. Three-member pureScale (member 0, 1, 2) Three-member pureScale(member 0, 3, 4) Yes, but must be an offline image with the WITHOUT ROLLING FORWARD option set. No
No common member exists between the source image and the target instance. Two-member pureScale (member 0, 1) Two-member pureScale (member 2, 3) No No
Note: For steps on restoring a pureScale backup image to a non-pureScale instance, see Restore from Db2 pureScale Feature to Db2 Enterprise Server Edition. For steps on restoring a non-pureScale backup image to a pureScale instance, see Restore from Db2 Enterprise Server Edition to Db2 pureScale instance.

Once the database is activated after recovery, the database topology is the same as the instance topology.

Example 1 - Restore and rollforward through an add member event

The following example shows the command syntax for backing up the sample database to an image, B0, from a source Db2® pureScale® instance that includes one member, member 0:
db2 backup database sample to /dev3/backup
The next step of the example shows the running of the db2iupdt command to process transactions on member 0, while adding member 1 to the source Db2 pureScale instance:
db2iupdt -m -add
The following example shows the command syntax for restoring the B0 backup image and its associated transaction logs on a target instance. This happens while transactions continue to be processed on members 0 and 1 on the source Db2 pureScale instance:
db2 restore database sample from /dev3/backup
The following example shows the command syntax for rolling forward to the end of the transaction logs:
db2 rollforward database sample to end of logs and stop

The Db2 pureScale database is usable on the target instance, with members 0 and 1.

Example 2 - Restore and rollforward into an instance with more members

The following example shows the command syntax for creating a backup image, B0, of the sample database from a Db2 pureScale instance. This backup image contains one member, member 0:
db2 backup database sample to /dev3/backup
The following example shows the command syntax for restoring the backup image, B0, and its associated transaction logs to a Db2 pureScale instance that has two members, 0 and 1. This happens while transactions continue to be processed on member 0 on the source Db2 pureScale instance:
db2 restore database sample from /dev3/backup
The following example shows the command syntax for completing the rollforward operation:
db2 rollforward database sample and stop
The Db2 pureScale database is usable on the target instance, with members 0 and 1. Member 1 is added when a CONNECT command is issued from the member, or when an ACTIVATE DATABASE command is run.

Example 3 - Error scenario - Restore an online image to a target instance with fewer members than the source instance

The following example shows the command syntax for creating an online backup image, B0, of the sample database on a source Db2 pureScale instance, that has two members, 0 and 2:
db2 backup database sample to /dev3/backup online

The following example shows the command syntax for restoring the backup image, B0, to a target Db2 pureScale instance that has just one member, 0.

db2 restore database sample from /dev3/backup
An SQL1564N error is generated:
SQL1564N The restore or rollforward operation did not complete successfully
because the specified operation is not supported. Reason code "5".
On a target instance with one member, member 0, attempting to restore the backup image, B0, results in an SQL1564N error:
SQL1564N The restore or rollforward operation did not complete successfully because the specified operation is not supported.
To restore using this backup image, the target instance must contain member 0 and 1.
Attempting to restore the image with the WITHOUT ROLLING FORWARD option set results in an SQL2537N error.
SQL2537N Roll-forward is required following the Restore.