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 DSN8D11A.DSN8S11D PAGE X'02'
VERIFY OFFSET 50 DATA X'0A00'
REPLACE OFFSET 50 DATA X'0D11'
DUMP OFFSET 50 LENGTH 4Example: 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')
DELETEExample: 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 DSN8D2APIf 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 SYSRECExample: Resetting restrictive states
The following REPAIR statement specifies that the 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.
//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 following REPAIR statement specifies that the utility is to update the version information in the catalog and directory for table spaces TLKQAST1, TSKQAST2, and TPKQAST3.
//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
Example: Checking for incorrect information in the catalog
Assume that you ran the DSN1COPY utility and want to make sure that you did not introduce any data integrity errors. Db2® automatically detects any data and catalog inconsistencies the first time that the data set is physically open after being populated by DSN1COPY. However, if you want to proactively check for these inconsistencies, you can use REPAIR. In this case, suppose that one of the affected table spaces is DBNAMET01.TSNAMET01. Issue the following REPAIR statement:
REPAIR CATALOG TABLESPACE DBNAMET01.TSNAMET01 TESTThis utility control statement specifies that REPAIR is to check for any inconsistencies between the data and catalog. If any inconsistencies are found, Db2 returns messages for them but does not correct them.
REPAIR CATALOG TABLESPACE DBNAMET01.TSNAMET01For more information about which inconsistencies are automatically corrected and which are reported through messages, see the description of CATALOG in Syntax and options of the REPAIR control statement
