Salesforce

How to compare table and index CRCs between 2 databases ?

« Go Back

Information

 
TitleHow to compare table and index CRCs between 2 databases ?
URL NameHow-to-compare-table-and-index-CRCs-between-2-databases
Article Number000186705
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: All supported platforms
Question/Problem Description
How to quickly verify for CRC conflicts between 2 copies of a database ?
How to see if same table in 2 different databases has matching CRCs ?
Steps to Reproduce
Clarifying Information
Use case:
If after deploying application updates CRC errors (1896) and/or (7968) start occuring, that usually means either the updated/recompiled r-code was not deployed correctly or the database schemas got pushed out of sync somehow.
Verifying if the CRCs are the same between the database instances is a quick step in finding which cause applies.
 
Error Message** CRC for <table-name> does not match CRC in <procedure>. Try recompiling. (1896)
** CRC for index '<index name>' on table '<table name>' does not match CRC in procedure '<procedure name>'. Try recompiling. (7968)
Defect Number
Enhancement Number
Cause
Resolution
Query the metaschema tables between both databases to check the _file._CRC and _index._idx-CRC values.

Example:
This assumes both databases can be connected at the same time, using logical names "db1" and "db2"): 
$   prowin sports2000 -ld db1 -db Sports2000 -ld db2
OUTPUT TO result.txt.

FOR EACH db2._file WHERE _tbl-type = 'T' NO-LOCK:
   FIND db1._file WHERE db1._file._file-name = db2._file._file-name AND db1._file._tbl-type = 'T' NO-LOCK NO-ERROR.

   IF NOT AVAILABLE(db1._file) THEN NEXT. /* table doesn't exist in both databases, so nothing to compare */
   
   IF db1._file._CRC <> db2._file._CRC THEN 
      MESSAGE "Table CRC mismatch for: " db2._file._file-name ". db1 has " db1._file._CRC ", db2 has " db2._file._CRC.

   FOR EACH db2._index OF db2._file NO-LOCK:
      FIND db1._index OF db1._file WHERE db1._index._index-name = db2._index._index-name NO-LOCK NO-ERROR.
      IF NOT AVAILABLE(db1._index) THEN NEXT. /* index doesn't exist in both databases, so nothing to compare */

      IF db2._index._idx-crc <> db1._index._idx-crc THEN DO:
         MESSAGE "Index CRC mismatch for: " db2._file._file-name + "." + db2._index._index-name ". db1 has " db1._index._idx-CRC ", db2 has " db2._index._idx-CRC.
      END.
   END.
END.

OUTPUT CLOSE.
Workaround
Notes
Keyword Phrase
Last Modified Date6/21/2019 4:06 PM

Powered by