Sample REPAIR control statements

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

Example: Replacing damaged data and verifying replacement

The following control statement specifies that the REPAIR utility is to perform the following actions:

  • Repair the specified page of table space DSN8D81A.DSN8S81D, as indicated by the LOCATE clause.
  • Verify that, at the specified offset (50), the damaged data (0A00) is found, as indicated by the VERIFY clause.
  • Replace the damaged data with the data that you want (0D11), as indicated by the REPLACE clause.
  • Initiate a dump beginning at offset 50, for 4 bytes, as indicated by the DUMP clause. You can use the generated dump to verify the replacement.
//STEP1    EXEC  DSNUPROC,UID='IUIQU1UH',UTPROC='',SYSTEM='DSN'
//SYSIN DD *
REPAIR OBJECT
  LOCATE TABLESPACE DSN8D10A.DSN8S10D PAGE X'02'
    VERIFY OFFSET 50 DATA X'0A00'
    REPLACE OFFSET 50 DATA X'0D11'
    DUMP OFFSET 50 LENGTH 4

Example: Removing a nonindexed row that is found by REORG

When reorganizing table space DSNDB04.TS1, assume that you received the following message:

DSNU3401 DSNURBXA - ERROR LOADING INDEX, DUPLICATE KEY
                    INDEX = EMPINDEX
                    TABLE = EMP
                    RID OF INDEXED ROW  = X'0000000201'
                    RID OF NONINDEXED ROW = X'0000000503'

To resolve this error condition, submit the following control statement, which specifies that REPAIR is to delete the nonindexed row and log the change. (The LOG keyword is not required; the change is logged by default.) The RID option identifies the row that REPAIR is to delete.

REPAIR
  LOCATE TABLESPACE DSNDB04.TS1 RID (X'0000000503')
    DELETE

Example: Reporting whether catalog and directory DBDs differ

The following control statement specifies that REPAIR is to compare the DBD for DSN8D2AP in the catalog with the DBD for DSN8D2AP in the directory.

REPAIR DBD TEST DATABASE DSN8D2AP

If the condition code is 0, the DBDs are consistent. If the condition code is not 0, the DBDs might be inconsistent. In this case, run REPAIR DBD with the DIAGNOSE option, as shown in example 4, to find out more detailed information about any inconsistencies.

Example: Reporting differences between catalog and directory DBDs

The following control statement specifies that the REPAIR utility is to report information about the inconsistencies between the catalog and directory DBDs for DSN8D2AP. Run this job after you run a REPAIR job with the TEST option (as shown in example 3), and the condition code is not 0. In this example, SYSREC is the output data set, as indicated by the OUTDDN option.

REPAIR DBD DIAGNOSE DATABASE DSN8D2AP OUTDDN SYSREC

Example: Repairing a table space with an orphan row

After running DSN1CHKR on table space SYSDBASE, assume that you receive the following message:

DSN1812I ORPHAN ID = 20 ID ENTRY = 0190 FOUND IN
         PAGE = 0000000024

From a DSN1PRNT of page X'0000000024' and X'0000002541', you identify that RID X'0000002420' has a forward pointer of X'0000002521'.

Repair the table space by taking the following actions:

  1. Submit the following control statement, which specifies that REPAIR is to set the orphan's backward pointer to zeros:
    REPAIR OBJECT LOG YES
     LOCATE TABLESPACE DSNDB06.SYSDBASE RID X'0000002420'
      VERIFY OFFSET X'0A' DATA X'0000002422'
      REPLACE OFFSET X'0A' DATA X'0000000000'
    Setting the pointer to zeros prevents the next step from updating link pointers while deleting the orphan. Updating the link pointers can cause DB2® to abnormally terminate if the orphan's pointers are incorrect.
  2. Submit the following control statement, which deletes the orphan:
    REPAIR OBJECT LOG YES
     LOCATE TABLESPACE DSNDB06.SYSDBASE RID X'00002420'
      VERIFY OFFSET X'06' DATA X'00002521'
      DELETE

Example: Resetting restrictive states

The control statement in this example specifies that the REPAIR utility is to reset the following restrictive states for the indicated objects:

  • For all indexes on table spaces DBNI1601.TSNI1601 and DBNI1601.TSNI1602, reset RBDP, PSRBDP, or RBDP* status.
  • For partition 1 of table space DBNI1601.TSNI1601 and partition 4 of table space DBNI1601.TSNI1602, reset ACHKP status.
  • For partitions 1 and 4 of table space DBNI1601.TSNI1601, reset CHKP status.
Figure 1. REPAIR SET example control statement
//STEP3    EXEC DSNUPROC,UID='JUNIU116.RECV1',                               
//            UTPROC='',SYSTEM='SSTR'                                        
//SYSIN    DD *                                                              
  REPAIR OBJECT                                                              
  SET INDEX (ALL) TABLESPACE DBNI1601.TSNI1601 NORBDPEND                     
  SET INDEX (ALL) TABLESPACE DBNI1601.TSNI1602 NORBDPEND                     
  SET TABLESPACE DBNI1601.TSNI1601 PART 1 NOAUXCHKP                           
  SET TABLESPACE DBNI1601.TSNI1602 PART 4 NOAUXCHKP      
  SET TABLESPACE DBNI1601.TSNI1602 PART 1 NOCHECKPEND    
  SET TABLESPACE DBNI1601.TSNI1602 PART 4 NOCHECKPEND  
/*

Example: Updating version information

The control statement in this example specifies that REPAIR is to update the version information in the catalog and directory for table spaces TLKQAST1, TSKQAST2, and TPKQAST3.

Figure 2. REPAIR VERSIONS example control statement
//STEP1    EXEC DSNUPROC,UID='JUKQU3AS.REPAIR',TIME=1440,        
//         UTPROC='',                                            
//         SYSTEM='SSTR'                             
//SYSIN    DD *                                                       
  REPAIR VERSIONS TABLESPACE DBKQAST1.TLKQAST1                   
  REPAIR VERSIONS TABLESPACE DBKQAST2.TSKQAST2                   
  REPAIR VERSIONS TABLESPACE DBKQAST3.TPKQAST3  

Example: Repairing a table space with clones

The control statement specifies that REPAIR is to reset the auxiliary CHECK-pending (ACHKP) status of the specified table space and process only the specified objects that are table spaces that contain clone tables, indexes on clone tables, or index spaces that contain indexes on clone tables.

REPAIR                               
    SET TABLESPACE DBKQDB01.TPKQDB01   
    NOAUXCHKP CLONE