Example: Restoring objects with partial transactions

If you perform save-while-active operations that can result in objects that are saved with partial transactions, it is recommended that you use Backup, Recovery, and Media Services (BRMS). You can use BRMS to automate your backup and recovery operations. BRMS automatically applies changes to objects with partial transactions and restores them to a usable state.

If an object is saved with partial transactions, FROMENT(*LASTSAVE) will be required when applying or removing journaled changes on the restored version of the object.

When you use the character-based interface to restore objects with partial transactions, perform the following steps to restore libraries CHK and SAV:

  1. Restore the two libraries with the following commands:
    RSTLIB SAVLIB(CHK) DEV(TAP01)
    
    RSTLIB SAVLIB(SAV) DEV(TAP01)

    If the journals still exist on the system, they are not restored. However, this is not a problem.

    If they did not exist, the server will restore the journal objects before the other objects.

  2. Restore the earliest receiver as specified by the outfile. If the journal receivers are in libraries other than CHK or SAV at the time of the save and they do not currently exist on the server, use the following restore command to restore the receivers:
    RSTOBJ OBJ(attached-receiver-at-save-time) +
           SAVLIB(receiver-library) +
           DEV(TAP01) +
           OUTPUT(*OUTFILE)OUTFILE(lib/file)

    If the attached receivers were in CHK or SAV when you saved the data and they did not exist prior to the RSTLIB operation, they were restored as part of that RSTLIB operation

  3. Determine a point in time, or application boundary, in which to bring the objects in CHK and SAV. This way all of the objects are in a consistent state in relationship to each other. After determining the desired application boundary, you might need to restore additional journal receivers. You can use the WRKJRNA command to determine the appropriate range of receivers you need for the ensuing Apply Journaled Changes (APYJRNCHG) operations. You can use the DSPJRN command to locate the exact sequence number that identifies the desired application boundary. If multiple journals are involved, you must locate the same application boundary (most likely identified by the timestamp) in each journal. You must also note the appropriate journal sequence number. If you need to restore additional journal receivers, but the receivers are not online, restore them with the following restore command. Multiple restore commands may be necessary for this step:
    RSTOBJ OBJ(other-needed-receivers) +
           SAVLIB(receiver-library) +
           DEV(TAP01)
  4. Bring the objects forward to a specific application boundary with one of the following Apply Journaled Changes (APYJRNCHG) commands. Different variations of the APYJRNCHG command may be appropriate based on the given criteria.

    If any objects received changes during the save operation, and they were under commitment control, the commit boundaries will be preserved on the following APYJRNCHG commands. If you do not wish to have the commitment control boundaries preserved, then you would need to specify CMTBDY(*NO) on the following APYJRNCHG commands.

    1. Use the commands below to apply the journaled changes to the objects (completed or partial) if the following is true:
      • The objects were saved prior to V5R3.
      • You did not restore the Journal because the objects were being restored to the system from where they were saved.
      • The media used represent the most recent save of the objects.
      • You saved the objects specifying UPDHST(*YES) on the save command.
      APYJRNCHG JRN(jrnlib/jrnname) +
                FROMENT(*LASTSAVE) +
                OBJ((CHK/*ALL)) +
                TOENTLRG(seq#-for-application-boundary) 
      
      APYJRNCHG JRN(jrnlib/jrnname) +
                FROMENT(*LASTSAVE) +
                OBJ((SAV/*ALL)) +
                TOENTLRG(seq#-for-application-boundary)

      If multiple journals are involved, then repeat these commands for each journal specifying the correct sequence number (TOENTLRG parameter) that identifies the desired application boundary. Note that the TOENTLRG sequence number is very likely different for each journal in CHK and SAV, but they all identify a common application boundary.

    2. Use the commands below to apply the journaled changes to the objects (completed or partial) if the following is true:
      • The objects were saved prior to V5R3.
      • You restored the journal.
      • The media used represent the most recent save of the objects.
      • You saved the objects specifying UPDHST(*YES) on the save command.
      APYJRNCHG JRN(jrnlib/jrnname) +
                OBJ((CHK/*ALL)) +
                RCVRNG(rcv-attached-at-save-time +
                       ending-rcv) +
                FROMENT(*LASTSAVE) +
                TOENTLRG(seq#-for-application-boundary)
      
      APYJRNCHG JRN(jrnlib/jrnname) +
                OBJ((SAV/*ALL)) +
                RCVRNG(rcv-attached-at-save-time +
                       ending-rcv) +
                FROMENT(*LASTSAVE) +
                TOENTLRG(seq#-for-application-boundary)

      In the situation where the journal is restored, and the journaled objects for which changes are going to be applied were saved prior to V5R3, the server cannot determine the correct receiver range. Therefore, the correct range of receivers must be specified on the RCVRNG parameter. Note that the attached receiver at the time that the libraries were saved is the specified starting journal receiver. If the journaled objects for which changes are going to be applied were saved in V5R3 or later, then the server can determine the correct receiver range when the default of RCVRNG(*LASTSAVE) is used. In this situation, the apply command from step a is correct.

      If multiple journals are involved, then repeat these commands for each journal specifying the correct sequence number (TOENTLRG parameter) that identifies the desired application boundary. Note that the TOENTLRG sequence number is very likely different for each journal in CHK and SAV, but they all identify a common application boundary.

    3. Do the following commands if your objects were saved prior to V5R3 and the save-while-active media used does not represent the most recent save of the objects specifying UPDHST(*YES).
      1. Use the DSPJRN command to determine the sequence number of the start-of-save journal entry for each object.
      2. Issue an individual APYJRNCHG command for each of the objects.
      The following example demonstrates such an APYJRNCHG command:
      APYJRNCHG JRN(jrnlib/jrnname) +
                OBJ((filelib/filename filembr)) +
                RCVRNG(rcv-attached-at-save-time +
                       ending-rcv) +
                FROMENT(seq#-for-start-of-save-entry) +
                FROMENT(*LASTSAVE) +
                TOENT(seq#-for-application-boundary)

      If you are not using V5R3 and the most recent save of the objects is not being used, FROMENT(*LASTSAVE) cannot be specified on the APYJRNCHG commands. An individual sequence number must be specified for each of the objects in libraries CHK and SAV

      Some of the APYJRNCHG commands could specify multiple objects if there is a continuous series of start-of-save entries in the journal. The members identified by the continuous series of start-of-save journal entries could be applied to with a single APYJRNCHG command by specifying the earliest sequence number of all the start-of-save entries in the continuous series for the FROMENT parameter. If you are using V5R3, use the *LASTSAVE value in the FROMENT parameter.

Related information
Backup, Recovery and Media Services