DB2 Server for VSE & VM: Data Restore Guide


Using the UNLOAD Command

The UNLOAD command can include up to 90 dbspace names on a maximum of 10 SYSIN lines. In VSE, the REWIND parameter on the OPTIONS line, can be used to specify whether the output tape should be positioned (REWIND=YES) on not (REWIND=NO). In VM, you can use the LEAVE parameter on the FILEDEF for the output file to achieve the same results. Depending on the requirements, you can direct the UNLOAD function in a variety of ways as shown on page UNLOAD.

The UNLOAD command unloads dbspaces to an output file.

Unloading All Dbspaces

You can use an asterisk instead of a dbspace name to unload all the tables as shown in Figure 96.

Figure 96. Unload All Dbspaces in the Database

(1) ---> UNLOAD DBSPACE=(*)

Statement 1
Indicates that all dbspaces are to be unloaded.

Figure 97 shows how to use the JCL to unload dbspaces in a VSE environment.

Figure 97. JCL to Unload All Dbspaces

          // JOB UNLOAD
(1)  ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2)  ---> // EXEC PROC=ARIS71DB
(3)  ---> // TLBL ARCHIV,'UNLOAD.DB2'
(4)  ---> // ASSGN SYS006,180
(5)  ---> // MTC REW,SYS006
(6)  ---> // EXEC XTS91001,SIZE=AUTO, PARM='DBNAME(dbname)'
(7)  ---> OPTIONS DEVICE=TAPE,REWIND=YES/NO
(8)  ---> CONTROL DBAPW=XXXXXXXX,DBNAME=dbname
(9)  ---> UNLOAD  DBSPACE=(*)
          /*

Statement 1
Specifies the DB2 library for the UNLOAD function.

Statement 2
Contains all DLBL defining directory, log, and all dbextents.

Statement 3
Identifies the label on the tape.

Statement 4
Assigns a specific tape drive that will be used.

Statement 5
Rewinds the tape to its first file.

Statement 6
Executes the program XTS91001.

Statement 7
Sets the device to a tape volume. In VSE, you can specify REWIND=YES or NO,(the default value is YES). If REWIND=NO is specified, at OPEN/CLOSE time the tape will not be positioned.

Statement 8
Uses the Control statement to specify the password for SQLDBA and identifies the dbname to be specified on the output file.

Statement 9
Specifies which database to UNLOAD. In this case, all dbspaces will be unloaded.

Figure 98 shows how to use an EXEC to unload dbspaces in a VM environment.

Figure 98. EXEC to Unload All Dbspaces

         /**/
(1) ---> 'FILEDEF ARCHIV TAP1 SL 1 (RECFM VB BLOCK 32760'
(2) ---> 'FILEDEF SYSPRINT DISK UNLOAD  SYSPRINT A'
(3) ---> 'FILEDEF SYSIN DISK UNLOAD SYSIN A'	
(4) ---> 'XTS91001'

The SYSIN file must contain the following statements:

Figure 99. SYSIN File to Specify Unloading All Dbspaces

(5) ---> CONTROL DBNAME=dbname DBAPW=XXXXXXXX
(6) ---> UNLOAD DBSPACE=(*)

Statement 1
Identifies the output file.

Statement 2
Identifies the SYSPRINT file

Statement 3
Identifies the SYSIN file.

Statement 4
Executes the program XTS91001.

Statement 5
Uses the Control statement to specify the password for the SQLDBA and identifies the dbname to be processed.

Statement 6
Specifies the type of UNLOAD to perform. In this case, an UNLOAD of all dbspaces will be performed.

Make sure that when you are executing Data Restore you can access the dbname SQLFDEF file on the database production disk.


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