Checking the records
After you locate the DBD in the dump, the records can be analyzed for inconsistencies.
Procedure
To check each record that is located by OBD:
- If the record OBD is marked, make a note that it is a duplicate OBD (indicating an error) and return to the procedure that referred you here. If it is not marked, continue with the next step.
- Determine whether the OBDREFIL field of the OBDREC matches the file OBID. If not, make a note of the error and continue.
- Cross-check the OBD with the catalog. Issue the following
SQL statement, replacing
dbidwith the DBID of the DBD being checked, andobidwith the OBID of the record OBD being checked.SELECT NAME, CREATOR FROM SYSIBM.SYSTABLES WHERE DBID=dbid AND OBID=obid;The result is one row of output; if you receive more or less than one row, make a note of the error.
- Issue the following SQL statement, replacing
namewith the NAME you received in the row of output from the previous SELECT, andcreatorwith the CREATOR you received.SELECT COUNT(*) FROM SYSIBM.SYSCOLUMNS WHERE TBNAME=name AND TBCREATOR=creator;The result is equal to the value of the OBDRENFD field of OBDREC; this field contains the number of columns in the table.
If the result is not as previously described, make a note of the error.
- Check the index chain of the record. The OBDRECHI field
of the OBDREC contains the OBID of the first index OBD (OBDFS). The
OBDFSFSC field of the OBDFS contains either 0 or the OBID of the next
index OBD. 0 indicates the last index OBD.
Check the index fan set chain. Mark each index fan set OBD (indicated by an OBDTYPE field that equals B'00') defined on the record. Perform the check that is described under Checking the indexes.
If the index chain is damaged (that is, the OBD located is not an index type OBD), make a note of the error.
-
Check the referential integrity (RI) relationship chains of the record.
-
Parent record: The OBDRELPA field of the OBDREC contains the OBID of the first RI relationship
OBD (OBDFS) in which the record is a parent. The OBDFSFSP field of the OBDFS contains either a 0 or
the OBID of the next RI relationship OBD in which the record is a parent. A 0 indicates the last RI
relationship OBD.
Be sure that the record that is a parent in an RI relationship has a primary key and a primary index. The OBDRDEF field in the OBDREC equals binary B'0' if a primary key and an index exist.
- Dependent record: The OBDRELCH field of the OBDREC contains the OBID of the first RI relationship OBD (OBDFS) in which the record is a child. The OBDFSFSC field of the OBDFS contains either a 0 or the OBID of the next relationship OBD in which the record is a child. A 0 indicates that it is the last RI relationship OBD.
-
Parent record: The OBDRELPA field of the OBDREC contains the OBID of the first RI relationship
OBD (OBDFS) in which the record is a parent. The OBDFSFSP field of the OBDFS contains either a 0 or
the OBID of the next RI relationship OBD in which the record is a parent. A 0 indicates the last RI
relationship OBD.
-
Check the RI relationship fan set chains. Mark each RI relationship fan set OBD (indicated by
an OBDTYPE field that equals binary B'00' and an OBDFSDC field that equals binary
B'1') defined on the record. Perform the checks that are described under Checking the referential integrity relationships
If the RI relationship chain is damaged (that is, the OBD located is not an RI relationship-type OBD), make a note of the error.
- Check the auxiliary relationship chains. To do this task, examine the first and second extensions to the OBDREC. Find the first extension (OBDRX) by adding the offset in OBDREXTO to the address of the OBDREC. Find the second extension (OBDRX2) by adding the offset in OBDREXT2 (which is in OBDRX) to the address of OBDRX. If OBDRXLOB (in OBDRX) equals B'1' and OBDRXILO (in OBDRX) equals B'0', then OBDRX2RA (in OBDRX2) contains the OBID of the first auxiliary relationship OBD (OBDRA) for the table. The OBDANEXT field of the OBDRA contains either 0 or the OBID of the next OBDRA. Perform the checks that are described in Checking the auxiliary relationships. If the relationship chain is damaged (that is, the OBD located is not an auxiliary relationship-type OBD), make a note of the error.
- Return to the procedure that referred you here.
Example
