Basic integrity verification and restore scripts
-------------------------------------------------

These scripts are database schema level integrity check. Integrity violations such as duplicates, non-referenced entities or other specific entity relations are verified and restored.

List of integrity verifications done by the basic_integrity_verify.sh script are below. The basic integrity restore script deletes or cleans up some of the integrity violations found by verification script. If you suspect more data integrity problems that needs restoration please contact product support.

# Duplicate violations are checked for 
* category hierarchy 
* category 
* item 
* item-category mapping 
* node order 

# Non referenced/orphaned entity checking is done for 
* item attributes not referencing an item 
* item-category mapping not referencing an item 
* item not referencing item-category mapping 
* item not referencing item detail 
* item detail (blob) not referencing item 
* category not referencing category detail 
* category full paths not having category 
* category spec map not having category 
* category sys attribute not having category 
* parent and child rows in category hierarchy not in category 
* source and destination rows in category hierarchy not in category 
* Item category map not having category 
* Category not having full paths 
* Category spec map not having full paths 
* Parent and child hierarchy not having full paths 
* Source and destination rows in category hierarchy not having category full path 
* Category sys attributes not having full paths 
* Item category map not having category full paths 

# Check for unique entries within a node attributes


Usage:
------
****************************************************
*It is strongly recommended to backup the database *
*before running basic_integrity_restore.sh script. *
****************************************************

For better performance, run analyze_schema.sh script before running either verify or restore scripts.

basic_integrity_verify.sh can be invoked as below 

./basic_integrity_verify.sh --code=<company code>

for example

./basic_integrity_verify.sh --code=ibm

basic_integrity_restore.sh can be invoked as below.

./basic_integrity_restore.sh --code=<company code>

for example

./basic_integrity_restore.sh --code=ibm

company code: you can get the company code from cmp table using "select * from cmp"

Ignore the following messages while running db2 scripts

SQL0100W  No row was found for FETCH, UPDATE or DELETE; or the result of a 
query is an empty table.  SQLSTATE=02000
