DB2 Server for VSE & VM: Data Restore Guide


Step 3. List the Changes Extracted from the Log Files

The RELOAD function can reload tables from a BACKUP file. All changes executed on the tables after the BACKUP function are recorded in the log.

After a RELOAD function, if the parameter RECOVERY=YES was specified on the OPTIONS statement (for more information see OPTIONS Statement Parameters; the LMBRLG1, LMBRLG2, LMBRLG3 files contain all the SQL statements from the log that affect the table.

You can use the LISTLOG function to list the contents of these files. The APPLYLOG function must be used to apply the changes in these files. Tables reloaded from an UNLOAD file cannot have log changes applied.

Figure 118. List the Changes Extracted from the Log Input work files:


fig119

When You Need to Execute the LISTLOG Function

When you reload a table and request the RECOVERY process, all changes referenced in the log will be extracted. If, for example, you are recovering a table that was accidentally corrupted, and you reapply all the changes, the LUW that corrupted the table will also be reexecuted. You need to know the timestamp of that LUW so that you can reapply all changes up to but not including the LUW in error.

The timestamp is used during the APPLYLOG function (refer to Step 4. Apply LUWs Referenced in the Log to the Reloaded Tables for more information) on the END parameter to apply the log changes up to the LUW in error.
Note:The timestamp of each LUW and SQL command has the following format:

YYYY-DDD-HH-MM-SS-mmmmmm

Example: 1995-260-23-59-59-000000

Using the LISTLOG Command

To list the contents of LMBRLG1, LMBRLG2, and LMBRLG3, execute the LISTLOG function using the XTS91001 program.

The following is an example of JCL (VSE) to list the contents of the recovery files.

Figure 119. Example JCL to List the Contents of the Recovery Files

         // JOB LISTLOG
(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) ---> LISTLOG
         /*

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

Statement 2
Specifies the work file LMBRWRK which may be 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 LISTLOG function.

The following is an example of an EXEC to list the contents of the recovery files.

Figure 120. Sample Procedure to List the Content of 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 function 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 121. Control Statement for LISTLOG in a VM Environment

(1) ---> CONTROL DBAPW=XXXXXXXX
(2) ---> LISTLOG

Statement 1
Specifies the password for user SQLDBA.

Statement 2
Specifies the LISTLOG function.

Example of a Report from LISTLOG Execution

For each row in the LMBRLG1 file, two lines are displayed:

  1. An identification line that contains three pieces of information: a committed or rolled back indicator (C or R), the LUWID, and the timestamp.
  2. The SQL statement that was executed.

Figure 122. Example Report After LISTLOG Function Execution

(1) ---> C 00004084 1995-251-10-56-29-861568
(2) ---> INSERT INTO "SQLDBA"."CUSTOMERS" VALUES ('TEST',0,200)
(3) ---> R 00004092 1995-256-10-58-00-126994
(4) ---> DELETE FROM "SQLDBA"."CUSTOMERS" WHERE "CUST_NO"=1245

Statement 1
Specifies that the LUW number 00004084 was committed at 10-56-29861568 on day 251 in 1995.

Statement 2
Shows that the SQL statement executed was an INSERT into the table SQLDBA.CUSTOMERS.

Statement 3
Specifies that LUW number 00004092 was rolled back at 10-58-00-126994 on day 251 in 1995.

Statement 4
Shows that the SQL statement executed was a DELETE from table SQLDBA.CUSTOMERS.


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