Sample RECOVER control statements

Use the sample control statements as models for developing your own RECOVER control statements.

Example 1: Recovering a table space

The following control statement specifies that the RECOVER utility is to recover table space DSN8D12A.DSN8S12D to the current point in time.

RECOVER TABLESPACE DSN8D12A.DSN8S12D

Example 2: Recovering a table space partition

The following control statement specifies that the RECOVER utility is to recover the second partition of table space DSN8D12A.DSN8S12D. The partition number is indicated by the DSNUM option.

RECOVER TABLESPACE DSN8D12A.DSN8S12D DSNUM 2

Example 3: Recovering a table space partition to the last image copy that was taken

The following control statement specifies that the RECOVER utility is to recover the first partition of table space DSN8D12A.DSN8S12D to the last image copy that was taken. If the last image copy that was taken is a full image copy, this full image copy is restored. If the last image copy that was taken is an incremental image copy, the most recent full image copy, along with any incremental image copies, are restored.

RECOVER TABLESPACE DSN8D12A.DSN8S12D DSNUM 1 TOLASTCOPY

Example 4: Recovering table spaces to a point in time

The following control statement specifies that the RECOVER utility is to recover the second partition of table space DSN8D12A.DSN8S12E and all of table space DSN8D12A.DSN8S12D to the indicated quiesce point (LRSN X'00000551BE7D'). The quiesce point is indicated by the TOLOGPOINT option. The value for this option can be either an LRSN or an RBA.

RECOVER TABLESPACE DSN8D12A.DSN8S12E DSNUM 2
        TABLESPACE DSN8D12A.DSN8S12D
        TOLOGPOINT X'00000551BE7D'

Example 5: Recovering an index to the last full image copy that was taken without deleting and redefining the data sets

The following control statement specifies that the RECOVER utility is to recover index ADMF001.IADH082P to the last full image copy. The REUSE option specifies that Db2 is to logically reset and reuse Db2-managed data sets without deleting and redefining them.

RECOVER INDEX  ADMF001.IADH082P REUSE TOLASTFULLCOPY

Example 6: Recovering from concurrent copies

The following RECOVER statement specifies that the utility is to recover all of the objects that are included in the RCVR4_LIST. This list is defined by the preceding LISTDEF utility control statement. Because the most recent primary copy for all of these objects is a concurrent copy, CURRENTCOPYONLY option in the RECOVER statement improves the performance of restoring these concurrent copies. The LOCALSITE option indicates that RECOVER is to use image copies at the local site.

//STEP1    EXEC DSNUPROC,UID='JUOLU210.RCVR4',    
//         UTPROC='',                             
//         SYSTEM='SSTR'                          
//UTPRINT  DD  SYSOUT=*                           
//SYSUT1   DD DSN=JUOLU210.RCVR4.STEP1.SYSUT1,    
//         DISP=(MOD,DELETE,CATLG),               
//         UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SORTOUT  DD DSN=JUOLU210.RCVR4.STEP1.SORTOUT,   
//         DISP=(MOD,DELETE,CATLG),               
//         UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) 
//SYSIN    DD *   
                
   LISTDEF RCVR4_LIST                                              
     INCLUDE TABLESPACES TABLESPACE DBOL1002.TSOL1002              
     INCLUDE TABLESPACES TABLESPACE DBOL1003.TPOL1003 PARTLEVEL 3  
     INCLUDE TABLESPACES TABLESPACE DBOL1003.TPOL1003 PARTLEVEL 6  
     INCLUDE TABLESPACES TABLESPACE DBOL1003.TPOL1004 PARTLEVEL 5  
     INCLUDE TABLESPACES TABLESPACE DBOL1003.TPOL1004 PARTLEVEL 9  
     INCLUDE INDEXSPACES INDEXSPACE DBOL1003.IPOL1051 PARTLEVEL 22 
     INCLUDE INDEXSPACES INDEXSPACE DBOL1003.IPOL1061 PARTLEVEL 10 
     INCLUDE INDEXSPACES INDEXSPACE DBOL1003.IXOL1062              
                                                                   
   RECOVER LIST RCVR4_LIST                                         
           LOCALSITE                                               
           CURRENTCOPYONLY                                         
 /*                                                                                                        

Example 7: Recovering a list of objects on different tape devices in parallel

The following RECOVER statement specifies that the utility is to recover the list of table spaces. Full image copies and incremental image copies of the eight table spaces are stacked on four different tape volumes. The utility sorts the list of objects and, if possible, recovers two objects at a time in parallel. This number of objects is specified by the PARALLEL option. The TAPEUNITS option specifies that up to four tape drives are to be dynamically allocated.

//RECOVER   EXEC DSNUPROC,SYSTEM='DSN'
//SYSIN    DD *
RECOVER PARALLEL(2) TAPEUNITS(4)
TABLESPACE DB1.TS8
TABLESPACE DB1.TS7
TABLESPACE DB1.TS6
TABLESPACE DB1.TS5
TABLESPACE DB1.TS4
TABLESPACE DB1.TS3
TABLESPACE DB1.TS2
TABLESPACE DB1.TS1

Example 8: Recovering a list of objects to a point in time

The following RECOVER control statement specifies that the RECOVER utility is to recover the specified list of objects to a common point in time (LRSN X'00000551BE7D'). The LISTDEF control statement defines which objects are to be included in the list. These objects are logically consistent after successful completion of this RECOVER job. The PARALLEL option indicates that RECOVER is to restore four objects at a time in parallel. If any of the image copies are on tape (either stacked or not stacked), RECOVER determines the number of tape drives to use to optimize the process. Any uncommitted work for all of the objects at the specified RBA are backed out by the recover operation to a point in time with consistency.

LISTDEF RCVRLIST INCLUDE TABLESPACE DSN8D81A.DSN8S81D  
         INCLUDE INDEX DSN8810.XDEPT1                         
         INCLUDE INDEX DSN8810.XDEPT2                         
         INCLUDE INDEX DSN8810.XDEPT3                         
         INCLUDE TABLESPACE DSN8D81A.DSN8S81E                 
         INCLUDE INDEX DSN8810.XEMP1                          
         INCLUDE INDEX DSN8810.XEMP2                          
RECOVER LIST RCVRLIST TOLOGPOINT X'00000551BE7D' PARALLEL(4) 

Example 9: Recovering an image copy

The following control statement specifies that RECOVER is to search for an image copy with an RBA or LRSN value earlier than the specified X'00000551BE7D' value to use in the RESTORE phase. Only specified dumps of the database copy pool are used for the restore of the data sets.

RECOVER LIST RCVRLIST RESTOREBEFORE X'00000551BE7D' PARALLEL(4) 
   FROMDUMP DUMPCLASS(dcname)

Example 10: Recovering clone table data

The following control statement specifies that the RECOVER utility is to recover only clone table data in DBA90601.TLX9061A and recover the data to the last image copy that was taken. The REUSE option specifies that RECOVER is to logically reset and reuse DB2®-managed data sets without deleting and redefining them.

RECOVER TABLESPACE DBA90601.TLX9061A REUSE TOLASTCOPY  
          CLONE 
Start of change

Example 11: Recovering from a system-level backup from an alternate copy pool

The following RECOVER control statement specifies that only those system-level backups that are associated with the specified copy pool are candidates for a recovery base. The copy pool is specified by the ALTERNATE_CP option.

 LISTDEF RCVLIST INCLUDE TABLESPACE DSNDB06.SYSTSCPY  
 RECOVER LIST RCVLIST PARALLEL ALTERNATE_CP(ALTERNATE1)  

In this example, RECOVER can use system-level backups that are associated with the following copy pools:

  • DSN$ALTERNATE1$DB for the database copy pool
  • DSN$ALTERNATE1$LG for the log copy pool

The following output from this utility job shows that RECOVER chose to use a system-level backup and also indicates the particular system-level backup that was used:

DSNU1520I   220 14:07:40.78 DSNUCBRT - THE RECOVERY BASE FOR  TABLESPACE DSNDB06.SYSTSCPY
    IS THE SYSTEM LEVEL BACKUP  
 WITH DATE = 20140808, TIME 095319, AND TOKEN X'C4C2F2C1CD931537CA6A07E40000A5140114'
End of change
Start of change

Example 12: Performing a redirected recovery to the current state

The following control statement specifies that the RECOVER utility is to perform a redirected recovery at the space level to the current state. Assume that image copies were created with DSNUM ALL. The PROD* objects are recovered to the TEST* objects.

RECOVER
TABLESPACE TESTDB1.TESTTS1 FROM PRODDB1.PRODTS1
INDEXSPACE TESTDB1.TESTIS1 FROM PRODDB1.PRODIS1
PARALLEL 2
End of change
Start of change

Example 13: Performing a redirected recovery on a set of related objects

The following control statement specifies that the RECOVER utility is to perform a redirected recovery at the partition level to a point in time. Assume that image copies were created with DSNUM ALL or DSNUM n. The list of objects includes the base table space partitions, its related LOB table spaces, its related XML partitions, related RI dependent objects, and related indexes.

RECOVER 
  TABLESPACE TESTDB1.TESTTS2 DSNUM 1 FROM PRODDB3.PRODTS1 DSNUM 1 
  TABLESPACE TESTDB1.TESTTS2 DSNUM 2 FROM PRODDB3.PRODTS1 DSNUM 2 
  TABLESPACE TESTDB1.TESTTS2 DSNUM 3 FROM PRODDB3.PRODTS1 DSNUM 3 
  TABLESPACE TESTDB1.TESTTS2 DSNUM 4 FROM PRODDB3.PRODTS1 DSNUM 4 
  INDEXSPACE TESTDB1.TESTIS2 DSNUM 1 FROM PRODDB3.PRODIS1 DSNUM 1 
  INDEXSPACE TESTDB1.TESTIS2 DSNUM 2 FROM PRODDB3.PRODIS1 DSNUM 2 
  INDEXSPACE TESTDB1.TESTIS2 DSNUM 3 FROM PRODDB3.PRODIS1 DSNUM 3 
  INDEXSPACE TESTDB1.TESTIS2 DSNUM 4 FROM PRODDB3.PRODIS1 DSNUM 4 
  TABLESPACE TESTDB1.TESTLOBA DSNUM ALL FROM PRODDB3.PRODLOBA DSNUM ALL
  INDEXSPACE TESTDB1.ILOBAIXA DSNUM ALL FROM PRODDB3.ILOBAIXA DSNUM ALL  
  TABLESPACE TESTDB1.TESTLOBB DSNUM ALL FROM PRODDB3.PRODLOBB DSNUM ALL 
  INDEXSPACE TESTDB1.ILOBAIXB DSNUM ALL FROM PRODDB3.ILOBAIXB DSNUM ALL 
  TABLESPACE TESTDB1.TESTLOBC DSNUM ALL FROM PRODDB3.PRODLOBC DSNUM ALL
  INDEXSPACE TESTDB1.ILOBAIXC DSNUM ALL FROM PRODDB3.ILOBAIXC DSNUM ALL  
  TABLESPACE TESTDB1.TESTLOBD DSNUM ALL FROM PRODDB3.PRODLOBD DSNUM ALL 
  INDEXSPACE TESTDB1.ILOBAIXD DSNUM ALL FROM PRODDB3.ILOBAIXD DSNUM ALL 
  TABLESPACE TESTDB1.TESTXML2 DSNUM 1 FROM PRODDB3.PRODXML1 DSNUM 1 
  TABLESPACE TESTDB1.TESTXML2 DSNUM 2 FROM PRODDB3.PRODXML1 DSNUM 2 
  TABLESPACE TESTDB1.TESTXML2 DSNUM 3 FROM PRODDB3.PRODXML1 DSNUM 3 
  TABLESPACE TESTDB1.TESTXML2 DSNUM 4 FROM PRODDB3.PRODXML1 DSNUM 4 
  INDEXSPACE TESTDB1.IRNODEID DSNUM 1 FROM PRODDB3.IRNODEID DSNUM 1
  INDEXSPACE TESTDB1.IRNODEID DSNUM 2 FROM PRODDB3.IRNODEID DSNUM 2    
  INDEXSPACE TESTDB1.IRNODEID DSNUM 3 FROM PRODDB3.IRNODEID DSNUM 3    
  INDEXSPACE TESTDB1.IRNODEID DSNUM 4 FROM PRODDB3.IRNODEID DSNUM 4 
  INDEXSPACE TESTDB1.XMLIX DSNUM 1 FROM PRODDB3.XMLIX DSNUM 1    
  INDEXSPACE TESTDB1.XMLIX DSNUM 2 FROM PRODDB3.XMLIX DSNUM 2    
  INDEXSPACE TESTDB1.XMLIX DSNUM 3 FROM PRODDB3.XMLIX DSNUM 3    
  INDEXSPACE TESTDB1.XMLIX DSNUM 4 FROM PRODDB3.XMLIX DSNUM 4           
  TABLESPACE TESTDB1.TESTDEP2 DSNUM ALL FROM PRODDB3.PRODDEP1 DSNUM ALL
  INDEXSPACE TESTDB1.DEPIX2 DSNUM ALL FROM PRODDB3.DEPIX1 DSNUM ALL     
TOLOGPOINT X’lrsn-value’ PARALLEL 4 
End of change
Start of change

Example 14: Performing a redirected recovery for recovery time estimation of the base table space

The following control statement specifies that the RECOVER utility is to perform a redirected recovery at the partition level for the base table space. Assume that image copies were created with DSNUM ALL or DSNUM n. Because this redirected recovery is for recovery time estimation for the base table space only, VERIFYSET NO and ENFORCE NO are specified:

RECOVER
  TABLESPACE TESTDB1.TESTTS2 DSNUM 1 FROM PRODDB3.PRODTS1 DSNUM 1
  TABLESPACE TESTDB1.TESTTS2 DSNUM 2 FROM PRODDB3.PRODTS1 DSNUM 2
  TABLESPACE TESTDB1.TESTTS2 DSNUM 3 FROM PRODDB3.PRODTS1 DSNUM 3
  TABLESPACE TESTDB1.TESTTS2 DSNUM 4 FROM PRODDB3.PRODTS1 DSNUM 4
 PARALLEL 4 VERIFYSET NO ENFORCE NO
End of change