Restoring Db2 data

To restore data from the vSnap repository, define a job that restores data from either the latest backup or an earlier backup copy. Choose to restore data to the original instance or to an alternative instance on a different machine. Define the restore job by specifying recovery options, and save the job.

Before you begin

In the Restore pane, use the filters to show the instances from the primary or secondary sites. The default shows the restore points from all sites. If you cannot find a specific database, search by entering a database name in the search field.

Before you create a restore job for Db2®, ensure that the following requirements are met.
  • At least one Db2 backup job is set up and running successfully. For instructions about setting up a backup job, see Backing up Db2 data.
  • IBM Spectrum Protect Plus roles and resource groups are assigned to the user who is setting up the restore job. For more information about assigning roles, see Managing user access.

Before you start a restore operation to an alternative instance, ensure that the file system structure on the source machine is matched on the target machine. This file system structure includes table spaces, online logs, and the local database directory. Ensure that dedicated volumes with sufficient space are allocated to the file system structure. Db2 must be at the same version level on the source and target hosts for all restore operations, and an instance of the same name must exist on each host. For more information about space requirements, see Space requirements for Db2 protection. For more information about prerequisites and setup, see Prerequisites for Db2.

Procedure

  1. In the navigation pane, expand Manage Protection > Applications > Db2 > Restore.
  2. In the Db2 Restore pane, click a Db2 instance to show the databases in that instance.
  3. Expand the database that you want to restore to show the available restore points for that database.
    Figure 1. Restore panel for Db2
    Restore panel.

    Restore points are listed with the backup date and time, SLA policy, site information, and type.

  4. Choose the latest backup or an earlier backup from the Restore Points list, and select Restore by site or Restore by cloud/repository server :
    • To restore the latest backup, click the add icon the add to restore list  icon next to the database name on the right of the Restore Points table.
      To restore data with recovery options to a specific point-in-time, you must select the overall database.
      Figure 2. Selecting a database for point-in-time restore
      Select database for restore.
    • To choose a restore point from a different time, find the backup that you require and add it to the restore list by clicking the add icon the add to restore list  icon.
      Figure 3. Adding a specific backup the restore list
      Select a backup for restore.

    To remove the restore point from the list, click the delete icon the remove from restore list icon.

    For information about using cloud repositories for backup and restore jobs, see Offload to secondary backup storage, and IBM Spectrum Protect Plus on IBM Cloud.

    Attention: Ensure that you review the selected options before clicking Restore because data will be overwritten when the Overwrite existing data option is selected.
  5. To define options for the restore job, click Options.
    • Restore Type: Choose one of the following for your restore operation.
      • Test: In this mode, the agent creates a new database by using the data files directly from the vSnap repository. This option is available only when restoring to an alternative instance.
      • Production: In this mode, the Db2 application server first copies the files from the vSnap repository volume to the target host, which is either an alternative location or the original instance. That copied data is then used to start the database. This restore type is the only option available when you restore data to the original instance.
      • Instant Access: In this mode, no further action is taken after IBM Spectrum Protect Plus mounts the volume from the vSnap repository. Use the data for custom recovery from the files in the mounted volume. This option is available only when restoring data to an alternative instance.
    • Destination: Click Restore to original instance to restore data to the original server, or Restore to alternate instance to restore data to a different location that you can select from the locations listed.
    For the procedure to restore data to the original instance, see Restoring to the original instance. For the procedure to restore data to an alternative instance, see Restoring to an alternate instance.
  6. Define a recovery option for the restore operation in the Recover Options section.
    • No Recovery. This option skips any rollforward recovery after the restore operation. The database remains in a Rollforward pending state until you decide whether you want to run the rollforward operation manually.
    • Recover until end of backup. This option recovers the selected database to its state at the time the backup was created. The recovery process uses the log files that are included in the Db2 database backup.
    • Recover until end of available logs. This option is available only if you have enabled log backups in your Db2 backup job definition. IBM Spectrum Protect Plus uses the newest restore point. A temporary restore point for log backups is created automatically so that the Db2 database can be rolled forward to the end of the logs. This recovery option is not available if you selected a specific restore point from the list, it is only available when you add the overall database. When you add the overall database, the newest backup is automatically selected for the end of logs recovery.
    • Recover until specific point-in-time. This option includes all the backup data up to a specific point in time. This option is available only if you enabled log backups in your Db2 backup job definition. Configure a point in time recovery by a specific date and time, for example, Jan 1, 2019 12:18:00 AM. IBM Spectrum Protect Plus finds the restore points directly before and after the point-in-time chosen. During the recovery process, the older data backup volume and the newer log backup volume are mounted. A temporary restore point is created if the point in time is after the last backup. This recovery option is not available if you selected a specific restore point from the list. Selecting the overall database automatically selects the newest backup for the end of logs recovery process.
  7. Select application options in the Application Options section as follows.

    Application options are not available for instant access restore jobs.

    • Overwrite existing databases. Choose this option to replace existing databases that have the same names during the restore recovery process. If this option is not selected, the restore job fails when databases with the same name are found during the restore operation. If you select this option, ensure that the Db2 log directory and the Db2 mirror log directory have no data.
      Attention: Ensure that no other databases share the same local database directory as the original database or that data is overwritten when this choice is selected.
    • Maximum Parallel Streams per Database. If required you can choose to run the restore operation of data in parallel streams. This option is useful when you are restoring a large database.
    • Specify the size of the Db2 database memory set in KB. Specify the memory, in KB, to be allocated for the database restore on the target machine. This value is used to modify the shared memory size of the Db2 database on the target server. To use the same shared memory size at both the source server and the target server, set the value to zero.
  8. Define advanced options for the restore job in the Advanced Options section as follows:
    • Run cleanup immediately on job failure. This option is selected by default to automatically clean up allocated resources as part of a restore operation when the recovery fails.
    • Continue with restores of other selected databases even if one fails. This option continues the restore operation if one database in the instance fails to be restored successfully. The process continues for all other databases that are being restored. When this option is not selected, the restore job stops when the recovery of a resource fails.
    • Mount Point Prefix. For instant access restore operations, specify the prefix for the path where the mount point is to be directed.
  9. Optional: Specify Scripts Settings by choosing one or more of the following actions:
    • Select Pre-script to select an uploaded script and an application or script server where the pre-script will run. To select an application server where the script will run, clear the Use Script Server check box. Navigate to the System Configuration > Script page to configure scripts and script servers.
    • Select Post-script to select an uploaded script and an application or script server where the post-script will run. To select an application server where the script will run, clear the Use Script Server check box. Navigate to the System Configuration > Script page to configure scripts and script servers.
    • Select Continue job/task on script error to continue running the job when the script associated with the job fails. When this option is enabled and the pre-script completes with a nonzero return code, the backup or restore job continues to run and the pre-script task status returns COMPLETED. If a post-script completes with a nonzero return code, the Post-script task status returns COMPLETED. When this option is not selected, the backup or restore job does not run, and the pre-script or post-script task status returns with a FAILED status.
  10. Review the job definition and click Save.
  11. To run the job immediately, click Restore. To specify a schedule for a repeated restore operation, click Manage Jobs to define a trigger for the job.
    Figure 4. Restore job definition in Manage Restore Jobs
    Manage restore job.

    To cancel the job, navigate to System Configuration and then click the Policy and Job List tab. Find the restore job that you want to cancel. Click Actions, and select Cancel.

    When the test restore operation is listed in the Active Resources pane, select Actions > Cancel to cancel that process. If the status is not updated, click Refresh to update the list.

Results

A few moments after you select Restore, the onDemandRestore record is added to the Job Sessions pane. To view progress of the restore operation, expand the job. You can also download the log file by clicking the download icon the add to restore list  icon.

To restore data to the original instance, follow the instructions in Restoring to the original instance. To restore data to an alternate instance, follow the instructions in Restoring to an alternate instance.