5 1 0:DB2 Restore

From SEPsesam
Other languages:


Docs latest icon.png Welcome to the latest SEP sesam documentation version 5.1.0 Apollon. For previous documentation version(s), check documentation archive.


Overview


The procedures and features explained herein provide only information about the SEP sesam-specific parts of DB2 restore. For detailed information on DB2-specific backup and recovery, see IBM DB2 documentation, such as RESTORE DATABASE command.

SEP sesam online backup module for IBM DB2 Universal Database (UDB) integrates with the XBSA interface of DB2 to provide efficient backup and restore of DB2 databases.

Prerequisites

  • Make sure that all preparation and backup steps are performed. See DB2 Backup for details.
  • Make sure that you have one of the following authorities on DB2 to perform a restore: SYSADM, SYSCTRL, or SYSMAINT.
  • Check if there is sufficient free space on the target storage system to which you are restoring your data.

You can restore a DB2 backup image by using standard DB2 RESTORE DATABASE command and its options. RESTORE DATABASE is used to recreate a full database or rebuild a damaged or corrupted database; it can also be used to overwrite a database with a different image or restore the database backup to a new database. You can perform cross-platform DB2 database restore if the operating system of the source system and the target system is the same.

Note that you can restore the offline full database backups and offline incremental database backups to a later database version; however, you cannot upgrade when restoring from online backups. For detailed information on RESTORE DATABASE command, see IBM RESTORE DATABASE command documentation.

For each database restored from an online DB2 backup, you must perform a roll forward recovery. This will place the restored DB2 database in a no longer pending state and allow connection to it.

Complete DB2 database restore

The RESTORE DATABASE command of the form db2 restore db <DB_name> will perform a full database restore with a database image as well as a table space restore operation of the table spaces found in a table space image. Note that you should use the same OPTIONS as you used for backup.

 db2inst@linux:~>db2 RESTORE DATABASE sample_db \
                     LOAD /opt/sesam/bin/sesam/db2xbsa.so \
                     OPTIONS 'SESAM_SERVER=midrangix;SESAM_JOB=abas_db2_2; \
                     XBSA_LOGFILE=/home/db2inst1/sdb2.log;XBSA_TRACE=1' \
                     TAKEN AT 20060113134350 TO "/tmp/db2restore" INTO sample_db2

Command syntax is as follows:

  • LOAD <shared_library>: Enter a full path of the SEP sesam library db2xbsa.so (Linux) or db2xbsa.dll (Windows).
  • TAKEN AT <date-time>: Define the backup image to be used for the restore by specifying the <timestamp:yyyymmddhhmmss> of the database backup image. This is shown after the backup completed successfully and is part of the path name for the backup image. <timestamp:yyyymmddhhmmss>. It is not required only in case that there is only one database backup image in the target folder.
  • TO <target_directory>:Define the target database directory. It is ignored if restoring to an existing database. The specified drive and directory must be local.
  • INTO <target_database_alias>: Specify the target database alias; if it does not exist, it will be created.
    • When restoring a DB2 database backup to an existing database, the restored database inherits the alias and database name of the existing database.
    • When restoring a DB2 database backup to a non-existent database, the database will be created with the specified alias and database name. Its name must be unique on the system where it is restored.

When the restore operation of an online DB2 backup is finished, you must perform a roll forward recovery:

$ db2 rollforward db  rollforward db <DB_name> to end of backup and complete

where END OF BACKUP specifies that the partitions in the partitioned database should be rolled forward to the minimum recovery time. The minimum recovery time is the earliest point in time during a rollforward when a database is consistent (when the objects listed in the database catalogs match the objects that physically exist on disk). For more details, see IBM ROLLFORWARD DATABASE command documentation.


See also

DB2 Backup

Copyright © SEP AG 1999-2024. All rights reserved.
Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.