Usage Notes - TARA/ABU

Teradata Archive/Recovery Utility Reference

Product
TARA/ABU
Release Number
15.00
Language
English (United States)
Last Update
2018-09-25
dita:id
B035-2412
lifecycle
previous
Product Category
Teradata Tools and Utilities

Usage Notes

Many referential constraints can be defined for a table. When such a table is restored, these constraints are marked inconsistent. REVALIDATE REFERENCES FOR validates these inconsistent constraints against the target table.

If inconsistent constraints remain after REVALIDATE REFERENCES FOR has been executed, the SQL statement ALTER TABLE DROP INCONSISTENT REFERENCES must be used to remove them. See “RESTORE” on page 221.

REVALIDATE REFERENCES FOR creates error tables containing information about data rows that failed referential constraint checks.

One error table is created for each referential constraint when the corresponding reference index becomes valid again. The name of each error table consists of the referencing (or child) table name appended by the reference index number. Each error table has the same fields definitions as the corresponding referencing table. The rows it contains are exact copies of the rows that violated the referential constraint in the referencing table.

For inconsistent reference indexes that can be validated, REVALIDATE REFERENCES FOR:

  • Validates the inconsistent reference index on the target table and its parent/child tables
  • Creates an error table
  • Inserts rows that fail the referential constraint specified by the reference index into the error table
  • If an inconsistent reference cannot be validated, the index is skipped and reported in a message at the end of the operation.

    For information on referential integrity, see the SQL Fundamentals.

    Example  

    Suppose an Employee table has just been restored with two inconsistent references defined on the table. One indicates the Employee table references Department table; the other indicates Employee table references Project table.

    Now, Project table is dropped before a restore operation and the following statement is submitted:

       REVALIDATE REFERENCES FOR (Employee);

    Assuming the referential constraint specifying Employee references Department has reference index number 4, the following occurs:

    1 Error table Employee_4 is created with information about the data rows in Employee that reference Department.

    2 The reference index specifying Employee table is referencing Department table is validated.

    3 The reference index specifying that Employee table is referencing Project table remains inconsistent. A message reports that Employee table still contains inconsistent reference indexes.

    4 Submit the SQL statement:

       ALTER TABLE EMPLOYEE DROP INCONSISTENT REFERENCES;

    5 Query error table Employee_4 to correct the data rows in the Employee table.