DB2 Server for VSE & VM: Data Restore Guide


Examples of Reloading Tables in a VSE Environment

The following is an example of JCL (VSE) to reload tables from a BACKUP.
Note:The Data Restore backup must be loaded on logical device SYS006. If RECOVERY=YES is specified, any log archives will also be read from logical device SYS006.

Figure 190. Sample JCL to Reload Tables from a BACKUP File

         // JOB RELOAD
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL LMBRWRK,,,VSAM
(3) ---> // TLBL ARCHIV,'ARCHIVE.DB2',,,1
(4) ---> // ASSGN SYS006,180
(5) ---> // MTC REW,SYS006
(6) ---> // EXEC XTS91001,SIZE=AUTO,PARM='DBNAME(dbname)'
(7) ---> CONTROL DBNAME=dbname
(7) ---> OPTIONS DEVICE=TAPE
(7) ---> RELOAD CREATOR=SQLDBA TNAME=CUSTOMERS FUNCT=PURGE
(7) ---> RELOAD CREATOR=SQLDBA TNAME=SUPPLIERS
(7) --->        FUNCT=NEW
(7) --->        NEWTNAME=NEWSUPPLIERS
(7) --->        DBSPACE=SAMPLE
         /*

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

Statement 2
Specifies the work file LMBRWRK which is used if the reloaded tables contain LONG columns.

Statement 3
Specifies the ddname ARCHIV for the BACKUP file.

Statement 4
Assigns the tape containing the backup file.

Statement 5
Rewinds the tape.

Statement 6
Calls the program to execute the function. The dbname of the database to process must be specified on the PARM option.

Statement 7
Specifies the SYSIN for the program.

The following is an example of JCL (VSE) to reload from an UNLOAD DBSPACE.

Figure 191. Example JCL to Reload a Table from an UNLOAD File

         // JOB RELOAD
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL LMBRWRK,,,VSAM
(3) ---> // TLBL ARCHIV,'UNLOAD.DB2',,,1
(4) ---> // ASSGN SYS006,180
(5) ---> // MTC REW,SYS006
(6) ---> // EXEC XTS91001,SIZE=AUTO,PARM='DBNAME(dbname)'
(7) --->      CONTROL DBNAME=dbname
              OPTIONS DEVICE=TAPE
              RELOAD CREATOR=SQLDBA TNAME=CUSTOMERS FUNCT=REPLACE
         /*

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

Statement 2
Specifies the work file LMBRWRK which is used if the reloaded tables contain LONG columns.

Statement 3
Specifies the ddname ARCHIV for the UNLOAD file.

Statement 4
Assigns the tape containing the UNLOAD file.

Statement 5
Rewinds the tape.

Statement 6
Calls the program to execute the function. The dbname of the database to process must be specified on the PARM option.

Statement 7
Specifies the SYSIN for the program.

The following is an example of JCL (VSE) to reload and generate the log recovery file from the last BACKUP.

Figure 192. Example JCL to Reload a Table and Prepare Recovery from the Log

         // JOB RELOAD
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL LMBRWRK,,,VSAM
(3) ---> // DLBL LMBRLG1,,,VSAM
(3) ---> // DLBL LMBRLG2,,,VSAM
(3) ---> // DLBL LMBRLG3,,,VSAM
(4) ---> // TLBL ARCHIV,'ARCHIVE.DB2',,,1
(5) ---> // TLBL LARCHIV,,,,1
(6) ---> // ASSGN  SYS006, 180
(7) ---> // MTC REW,SYS006
(8) ---> // EXEC XTS91001,SIZE=AUTO,PARM='DBNAME(dbname)'
(9) --->    OPTIONS RECOVERY=YES  DEVICE=TAPE
(9) --->    RELOAD CREATOR=SQLDBA TNAME=CUSTOMERS FUNCT=REPLACE
         /*

Statement 1
Specifies the DB2 Server for VSE & VM and Data Restore libraries for the RELOAD function.

Statement 2
Specifies the work file LMBRWRK which is used if the reloaded tables contain LONG columns.

Statement 3
Specifies the work files LMBRLG1, LMBRLG2, and LMBRLG3 which are used to extract all changes referenced in the log for the reloaded tables when the RECOVERY=YES parameter is specified. They will be used to execute forward log recovery.

Statement 4
Specifies the ddname ARCHIV for the BACKUP file.

Statement 5
Specifies the ddname LARCHIV for the log archive files.

Statement 6
Assigns the tape containing the backup file.

Statement 7
Rewinds the tape.

Statement 8
Calls the program to execute the function. The dbname of the database to process must be specified on the PARM option.

Statement 9
Specifies the SYSIN for the program. The OPTIONS statement specifies that log recovery is requested.

The following is an example of JCL to reload from a DB2 Server for VSE archive.
Note:The DB2 Server for VSE archive must be loaded on logical device SYS007. If a TLBL is specified for the ARCHIV file, it must be loaded on logical device SYS006. If RECOVERY=YES is specified, any log archives will also be read from logical device SYS006.

Figure 193. Sample JCL to Execute the RELOAD Function from a DB2 Server for VSE Archiive.

         // JOB RELOAD
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL LMBRWRK,,,VSAM
(3) ---> // DLBL LMBRLG1,,,VSAM
(3) ---> // DLBL LMBRLG2,,,VSAM
(3) ---> // DLBL LMBRLG3,,,VSAM
(4) ---> // DLBL ARCHIV,,,VSAM,RECSIZE=4096,RECORDS=(100,100)
(5) ---> // TLBL LARCHIV,,,,1
(6) ---> // TLBL ARIARCH,'ARCHIVE.DB2',,,1
(7) ---> // ASSGN  SYS007, 180
(8) ---> // MTC REW,SYS007
(9) ---> // DLBL SYS0001,,,VSAM,RECSIZE=4096,RECORDS=(100,100)
(9) ---> // DLBL HEADER,,,VSAM,RECSIZE=4096,RECORDS=(100,100)
(9) ---> // DLBL DIRWORK,,,VSAM
(10)---> // EXEC XTS91001,SIZE=AUTO,PARM='DBNAME(dbname)'
(11)--->    OPTIONS  ARCHTYPE=DB2
(11)--->    CONTROL  DBNAME=dbname
(11)--->    RELOAD  CREATOR=SQLDBA,TNAME=CUSTOMERS FUNCT=NEW
(11)--->      DBSPACE=SAMPLE
         /*

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

Statement 2
Specifies the work file LMBRWRK which is used if the reloaded tables contain LONG columns.

Statement 3
Specifies the work files LMBRLG1, LMBRLG2, and LMBRLG3 which are used to extract all changes referenced in the log files for the reloaded tables when the RECOVERY=YES parameter is specified. They will be used to execute forward log recovery.

Statement 4
Specifies the work file ARCHIV for this process.

Statement 5
Specifies the ddname LARCHIV for the log archive file.

Statement 6
Specifies the ddname ARIARCH for the DB2 Server for VSE database archive file.

Statement 7
Assigns the tape containing the archive file.

Statement 8
Rewinds the tape.

Statement 9
Specifies the work files SYS0001, HEADER, DIRWORK for the function.

Statement 10
Calls the program to execute the function. The dbname of the database to process must be specified on the PARM option.

Statement 11
Specifies the SYSIN for the program. The OPTIONS statement specifies that the process is executed from a DB2 Server for VSE database archive.

The following is an example of a report generated by a RELOAD from a DB2 Server for VM archive.

Figure 194. Example Report from a RELOAD from a DB2 Server for VSE & VM Archive

(1) ---> XTS9-143 OPTIONS  ARCHTYPE=DB2
         XTS9-143 CONTROL  DBNAME=dbname READPW=RR
         XTS9-143 RELOAD  CREATOR=SQLDBA,TNAME=CUSTOMERS FUNCT=NEW
         XTS9-143  DBSPACE=SAMPLE
         XTS9-143 /*
         XTS9-196 Do you want to continue the RELOAD process ?
         XTS9-406 Enter 0(CANCEL) or 1(CONTINUE)
         XTS9-403 Reply is 1
         XTS9-100 Data Restore feature VERSION 7.1.0
(2) ---> XTS9-193 Mount first tape of database server archive
         XTS9-406 Enter 0(CANCEL) or 1(CONTINUE)
         XTS9-403 Reply is 1
(3) ---> XTS9-202 Processing database server archive (timestamp=1995-274-15-50-10)
         XTS9-169 Processing tables containing long columns
         XTS9-102        20 ROWS LOADED, PROCEDURE COMPLETED
         XTS9-128        20 ROWS LOADED INTO (SQLDBA.CUSTOMERS)
         XTS9-101         1 tables successfully processed
         CONNECT SQLDBA  ;
         COMMIT WORK ;
         XTS9-007 Processing successfully completed

Statement 1
Specifies that the input file is a DB2 Server for VM archive.

Statement 2
Prompts the operator to remount the first archive tape.

Statement 3
Displays the timestamp of the DB2 Server for VM archive.

Figure 195. Example of JCL to Reload in a VSE Environment From a Full Backup

        // JOB RELOAD
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL LMBRWRK,,,VSAM
(3) ---> // TLBL ARCHIV,'ARCHIVE.SQL',,,1
(4) ---> // ASSGN SYS006,180
(5) ---> // MTC REW,SYS006
(5) ---> // EXEC XTS91001,SIZE=AUTO,PARM='DBNAME(DBNAME)'
(7) ---> CONTROL DBNAME=DBNAME
(7) ---> OPTIONS DEVICE=TAPE
(7) ---> RELOAD CREATOR=SQLDBA TNAME=CUSTOMERS FUNCT=PURGE
(7) ---> RELOAD CREATOR=SQLDBA TNAME=SUPPLIERS
(7) --->        FUNCT=NEW
(7) --->        NEWTNAME=NEWSUPPLIERS
(7) --->        DBSPACE=SAMPLE
        /*

Statement 1
DB2 library must be specified for the RELOAD function.

Statement 2
LMBRWRK is used if the reloaded tables contain LONG columns.

Statement 3
ARCHIV is the ddname for the BACKUP file. It can be a BACKUP file or a FULL BACKUP.

Statement 4
The tape containing the backup file is assigned.

Statement 5
The tape is rewound.

Statement 6
Program to execute functions is called. The DBNAME of the database to process must be specified on the PARM option.

Statement 7
SYSIN for the program is specified.

Figure 196. Example of JCL to Reload in a VSE Environment From an Incremental Backup

          // JOB RELOAD
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // DLBL LMBRWRK,,,VSAM
(3) ---> // TLBL ARCHIV,'ARCHIVE.SQL',,,1
(4) ---> // TLBL FULLARC,'ARCHIVE.SQL',,,1
(5) ---> // ASSGN SYS006,180
(6) ---> // MTC REW,SYS006
(7) ---> // EXEC XTS91001,SIZE=AUTO,PARM='DBNAME(dbname)'
(8) ---> CONTROL DBNAME=dbname WRKSIZE=4096
(8) ---> OPTIONS DEVICE=TAPE DEVICE2=TAPE
(8) ---> RELOAD CREATOR=SQLDBA TNAME=CUSTOMERS FUNCT=PURGE
(8) ---> RELOAD CREATOR=SQLDBA TNAME=SUPPLIERS
(8) --->        FUNCT=NEW
(8) --->        NEWTNAME=NEWSUPPLIERS
(8) --->        DBSPACE=SAMPLE
         /*

Statement 1
DB2 library must be specified for the RELOAD function.

Statement 2
LMBRWRK is used if the reloaded tables contain LONG columns.

Statement 3
ARCHIV is the ddname for the last Incremental Backup.

Statement 4
FULLARC is the ddname for the last Full Backup.

Statement 5
The tape containing the backup file is assigned.

Statement 6
The tape is rewound.

Statement 7
Program to execute functions is called. The DBNAME of the database to process must be specified on the PARM option.

Statement 7
SYSIN for the program is specified. WRKSIZE must be equivalent to the parameter specified during the BACKUP function. DEVICE2 specifies if a TAPE or DASD (TLBL/DLBL) is used for Full Backup (FULLARC).


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