IBM Support

[DB2 LUW] SQL1117N error and how to reset ROLL-FORWARD PENDING state of a database and allow connections

Question & Answer


Question

After restoring a database from a backup image, connections to the database fail with SQL1117N error:
"A connection to or activation of database <dbname> cannot be made because of ROLL-FORWARD PENDING"
How can the status be reset and connections to the database be made successfully?

Cause

After restoring an online backup image, rollforward is mandatory. Rollforward applies any changes to the database whilst an online backup was in progress. Until the rollforward is completed, the database is in an inconsistent state.

By default, an online backup image includes the transaction log files which is needed to make the database consistent. The log files can be retrieved from the backup image and used to rollforward.

If restoring from an offline backup image, the "rollforward pending" state can be reset using the WITHOUT ROLLING FORWARD option in the RESTORE command.

Answer

Restoring an online backup
In the following example scenario, assume the online backup image of the SAMPLE database is placed in /data/backup/ and log files in the backup image will be retrieved into /tmp/logs.
  1. Login on the target system as the instance owner.
  2. Execute this command to retrieve the log files into the path specified in the "logtarget" parameter:
    $ db2 restore db sample from /data/backup logtarget /tmp/logs
    Note: If a database restore was already performed, the transaction log files can be retrieved by using the "logs" option:
    $ db2 restore db sample logs from /data/backup logtarget /tmp/logs
  3. Execute the following rollforward command to use the log files retrieved into "logtarget" path:
    $ db2 "rollforward db sample to end of backup and stop overflow log path ('/tmp/logs')"
 

Restoring an offline backup

In the following scenario, assume the offline backup image of the SAMPLE database is placed in the directory /data/backup.

  1. Login on the target system as the instance owner.
  2. Execute this command to restore the backup image with the WITHOUT ROLLING FORWARD option.
    $ db2 restore db sample from /data/backup without rolling forward

Additional tips:

The db2ckbkp command can be used to determine whether the backup was taken in an online or offline mode.  It can also be used to check if transaction log files are included in an online backup image.

(Unix/Linux)
$ db2ckbkp -h <path_to_backup_image> | grep -e Mode -e Includes

(Windows)
C:\>db2ckbkp -h <path_to_backup_image> | findstr "Mode Includes"

Sample output:
$ db2ckbkp -h /data/backup/SAMPLE.0.db2inst1.DBPART000.20171107164502.001 | grep -e Mode -e Includes
      Backup Mode                    -- 1 (Online)
      Includes Logs                  -- 1 (Yes)

With version 9.7 FP2 and later, the registry variable DB2_RESTORE_GRANT_ADMIN_AUTHORITY was introduced. This automatically grants the instance owner SECADM, DBADM, DATAACCESS, and ACCESSCTRL privileges on the databases restored. From version 9.7 FP5, the setting is dynamic and does not require an instance restart.

 

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"Recovery - Restore","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.7;10.1;10.5;11.1;11.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
24 October 2019

UID

ibm11074606