The REPAIR DBD Option

 <  Day Day Up  >  

The REPAIR DBD Option

The REPAIR utility can be used to test, maintain, and modify DB2 database information. DB2 maintains database information in the DB2 Catalog SYSIBM.SYSDATABASE table. An object known as a DBD is also maintained in the DB2 Directory in the SYSIBM.DBD01 "table." You can use the REPAIR option with the DBD specification to perform the following functions:

  • Test the definition of a DB2 database by comparing information in the DB2 Catalog to information in the DB2 Directory.

  • Diagnose database synchronization problems and report differences between the DB2 Catalog information and the DBD stored in the DB2 Directory.

  • Rebuild a DBD definition in the DB2 Directory based on the information in the DB2 Catalog.

  • Drop an invalid database (if the SQL DROP statement cannot be used because of database inconsistencies). REPAIR DBD can remove the DBD from the DB2 Directory and delete all corresponding rows from the appropriate DB2 Catalog tables.

Listing 31.5 contains sample JCL to REPAIR the DBD for the DSN8D51A sample database.

Listing 31.5. REPAIR DBD JCL
 //DB2JOBU  JOB (UTILITY),'DB2 REPAIR DBD',MSGCLASS=X,CLASS=X, //   NOTIFY=USER //* //**************************************************************** //* //*            DB2 REPAIR UTILITY  : : DBD REPAIR //* //**************************************************************** //* //UTIL EXEC DSNUPROC,SYSTEM=DSN,UID='REPRDBD',UTPROC=" //* //*  UTILITY INPUT CONTROL STATEMENTS //*       The first REPAIR statement builds a DBD based on //*       the DB2 Catalog and compares it to the corresponding //*       DBD in the DB2 Directory. //*       The second REPAIR statement reports inconsistencies, //*       if any exist. //* //DSNUPROC.SYSIN    DD  *     REPAIR DBD TEST DATABASE DSN8D61A     REPAIR DBD DIAGNOSE DATABASE DSN8D81A OUTDDN SYSREC /* // 

REPAIR DBD Guidelines

Log All Repairs

Run the REPAIR utility with the LOG YES option. This ensures that all data changes are logged to DB2 and are therefore recoverable.

Consult IBM Before Using DROP or REBUILD

Do not issue the REPAIR DBD utility with the DROP or REBUILD option without consulting your IBM Support Center. These options can be dangerous if used improperly.

Use TEST and DIAGNOSE for Error Resolution

When databases, or their subordinate objects, exhibit peculiar behavior, consider executing REPAIR DBD with the TEST option. If this run returns a condition code other than 0, run REPAIR DBD with the DIAGNOSE option and consult your IBM Support Center for additional guidance.

You should also consider implementing a regularly scheduled REPAIR DBD run to consistently check for problems.

 <  Day Day Up  >  


DB2 Developers Guide
DB2 Developers Guide (5th Edition)
ISBN: 0672326132
EAN: 2147483647
Year: 2004
Pages: 388

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net