DB2 Server for VSE & VM: Data Restore Guide


Step 4. Apply LUWs Referenced in the Log to the Reloaded Tables

After a RELOAD function has been processed, the table contains rows as they appeared in the table when the BACKUP was taken. All changes executed on the table after the BACKUP function was taken can be reprocessed by Data Restore on the reloaded table.

If among the log changes on a table, a DELETE FROM TABLE command was issued in error, you may want to stop the recovery before the DELETE command is reexecuted. By specifying END=timestamp, the recovery process stops before the timestamp. If a DROP command that involves one of the reloaded tables is encountered in the log, the recovery process stops automatically for the table.

Forward log recovery can only be processed from a BACKUP archive (not an UNLOAD) and on the original database. You cannot do log recovery after reloading a table into a different database.

Figure 123. Apply Changes From the Log To the Reloaded Tables


fig125

Using the APPLYLOG Command

To determine the value to specify for the END parameter, execute the LISTLOG function (for more information refer to Step 3. List the Changes Extracted from the Log Files). An example of the use of TIMESTAMP is: TIMESTAMP=1995-320-12-30-01-000000.

Notes:

  1. All LUWs whose timestamp is equal to or greater than the specified END timestamp will not be executed.

  2. The database server must be active during the APPLYLOG function and all changes on the database are logged.

  3. If you want to apply all changes, specify a timestamp greater than the timestamp of the last LUW in the log.

Execute the APPLYLOG Function

To process all the SQL statements in LMBRLG1, LMBRLG2, and LMBRLG3, execute the APPLYLOG function using program XTS91001.

You must have previously run the RELOAD function, from a BACKUP, with the RECOVERY=YES parameter to reload the tables.

The following is an example of JCL (VSE) to execute the statements in the recovery files.

Figure 124. Sample JCL to Execute SQL Statements in the Recovery Files

         // JOB APPLYLOG
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL LMBRWRK,,,VSAM
(3) ---> // DLBL LMBRLG1,,,VSAM
(3) ---> // DLBL LMBRLG2,,,VSAM
(3) ---> // DLBL LMBRLG3,,,VSAM
(4) ---> // EXEC XTS91001,SIZE=AUTO
(5) ---> CONTROL DBAPW=XXXXXXXX
(6) ---> APPLYLOG END=1995-260-23-59-59-000000
         /*

Statement 1
Specifies the DB2 Server for VSE Data Restore libraries.

Statement 2
Specifies the work file LMBRWRK which is used if the table contains LONG columns.

Statement 3
Specifies the work files LMBRLG1, LMBRLG2, and LMBRLG3 which contain data extracted from the log during the RELOAD process.

Statement 4
Runs the program XTS91001.

Statement 5
Specifies the password for user SQLDBA.

Statement 6
Specifies the APPLYLOG function with the END timestamp.

The following is an example on an EXEC to execute the SQL statements in the recovery files.

Figure 125. Sample EXEC to Execute SQL Statements in the Recovery Files

         /**/
(1) ---> 'FILEDEF SYSIN DISK LISTLOG SYSIN A'
(2) ---> 'FILEDEF SYSPRINT DISK LISTLOG SYSPRINT A'
(3) ---> 'FILEDEF LMBRWRK DISK LMBRWRK DATA A (RECFM FB BLOCK 28672 LRECL 4096'
(4) ---> 'FILEDEF LMBRLG1 DISK LMBRLG1 DATA A (RECFM VB BLOCK 32760'
(4) ---> 'FILEDEF LMBRLG2 DISK LMBRLG2 DATA A (RECFM VB BLOCK 32760'
(4) ---> 'FILEDEF LMBRLG3 DISK LMBRLG3 DATA A (RECFM VB BLOCK 32760'
(5) ---> 'XTS91001'

Statement 1
Specifies the SYSIN file which contains the function specification.

Statement 2
Specifies the SYSPRINT file which contains the output report.

Statement 3
Specifies the work file LMBRWRK which is used if the table contains LONG columns.

Statement 4
Specifies the work files LMBRLG1, LMBRLG2, and LMBRLG3 which contain data extracted from the log during the RELOAD process.

Statement 5
Runs the program XTS91001.

The SYSIN file must contain the following statements:

Figure 126. Sample SYSIN for the APPLYLOG Function

(1) ---> CONTROL DBAPW=XXXXXXXX
(2) ---> APPLYLOG END=1995-260-23-59-59-000000

Statement 1
Specifies the password for user SQLDBA.

Statement 2
Specifies the APPLYLOG function with the END timestamp.

Example of a Report from APPLYLOG

Figure 127. Example of a Report from APPLYLOG Execution

XTS9-143 OPTIONS      LANG=S001
XTS9-143 CONTROL DBAPW=********
XTS9-143 APPLYLOG  END=1996-255-16-46-47-646175
XTS9-143 /*
XTS9-100 Data Restore feature VERSION 7.1.0
XTS9-007 Processing successfully completed


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]