Loading...

DB2 Command Line Example: Restoring to a Point-in-Time

Use a point-in-time restore to revert the database to a state before an undesired transaction or before a point of failure.

Before You Begin

  1. Drop the database by using the DB2 command "db2 drop database <db_name>".
  2. Verify that the DB2 archive log path and the DB2 retrieve path are empty.
  3. Empty the DB2 online log path.

Procedure

  1. At the DB2 command prompt, type the following command, substituting the database_parameter database_name with your database name and the backup_image_timestamp with the backup image timestamp:

    Note: For a DB2 instance on 64-bit AIX, Solaris, HP PARISC or 64-bit Linux on System Z, replace Base with Base64.

    The backup image timestamp is 14 characters. It has the following format:

    yyyymmddhhmmss

    • yyyy - the year
    • mm - the 2 digit month representation  (01-12)
    • dd - the day
    • hh - the hour in 24-hour clock format (00-23)
    • mm  - the minute (0-59)
    • ss - the second (0-59)

      db2 restore db <database_name> load '/opt/commvault/Base/libDb2Sbt.so' taken at <backup_image_timestamp>

  2. On the command line, type the following command:

    db2 rollforward db database_name to time using local time and stop

    Where time has the format yyyy-mm-dd-hh.mm.ss

    Example

    db2 rollforward db test_database to 2017-07-26.05.00.000000 using local time and stop

Last modified: 7/10/2018 2:46:04 PM