Show TOC

Recovering Changes to the SAP System Since the Last BackupLocate this document in the navigation structure

Prerequisites

  • You have restored the database libraries R3<SID>DATA and SAP<SID>DB and the journal receiver libraries R3<SID>JRN and SAP<SID>JRN to the system.

  • You have restored enough journal receivers so that all open transactions during the backup time can be rolled back if necessary.

  • This only applies when the backup was done with the SAVACTWAIT option *NOCMTBDY.

  • You have restored all journal receivers in use between the last backup and the time right before the crash. You must delete the objects you want to restore.

Context

This procedure explains how to apply journal changes to database libraries that have been restored. There are two main reasons to do this:

  • If the libraries were saved with the SAVACTWAIT option *NOCMTBDY (online backup with partial transactions), journal changes must be applied or removed to ensure a consistent database.

  • If the backup was restored as a result of data loss, you may want to recover changes that were done by the application during the time between the backup and the data loss.

Procedure

  1. Link the journal receivers in libraries R3<SID>JRN and SAP<SID>JRN to the journal objects QSQJRN in the database libraries.
  2. Enter command WRKJRN.
  3. Specify QSQJRN as the journal and R3<SID>DATA or SAP<SID>DB as the library.
  4. Choose option 9 Associate receivers with journal in front of the journal QSQJRN.
  5. To recover changes that were applied to the database after the backup was performed, perform a forward recovery. To do this, enter the following command:

    APYJRNCHGX JRN(<database library>/QSQJRN) FILE((<database library>/*ALL *ALL)) RCVRNG(*LASTSAVE) TOTIME(<date and time right before the data loss>) CMTBDY(*YES)

    Note

    Beginning with IBM i 6.1, you can also use the command APYJRNCHG instead of APYJRNCHGX. In a future release, the command APYJRNCHGX may be removed from the operating system.

    Note

    Alternatively, you can revert all uncommitted changes at the time of the backup to reset the database to a consistent state. This is called a backward recovery.

  6. If applicable, repeat step 4 then continue with the next step below.

    To perform the backward recovery, enter the following command:

    RMVJRNCHG JRN(<database library>/QSQJRN) FILE((<database library>/*ALL *ALL)) RCVRNG(*LASTSAVE) FROMENTLRG(*LASTSAVE) TOENTLRG(*COMMITSTART) CMTBDY(*YES)

    Note

    If the RMVJRNCHG command fails with a message identifier CPF69AB Values for RCVRNG parameter not correct, check the second-level message text to identify the journal receivers that are missing. Then repeat command RMVJRNCHG and specify the correct range of receivers.

    Note

    If the RMVJRNCHG command fails with a message identifier CPD7016 Change not applied or removed to object type *QDDS, reason code X'09', a change to a database object has been detected that cannot be reverted by RMVJRNCHG. If your encounter this problem, perform a forward recovery instead ( APYJRNCHGX).

  7. Verify the completion message of command APYJRNCHGX or RMVJRNCHG and correct any error that may have occurred.