Many releases ago we had suspect indexes, so I routinely retrieved the
previous night's mirrored backup so I had a quiet copy of file and its
indexes and checked integrity.
It turned out to be fastest if I saved off the index somewhere, then
rebuilt it, then compared the saved to the newly built.
I couldn't verify everything every day, but just kept cycling thru over
a few days' time.
To be honest, that works only if there is no fundamental flaw in UV's
indexing, i.e., something that makes it build wrong in the 1st place.
Both the new & old would have the same corruption & you wouldn't see it.
If you suspect that, then you need to do your own completely. I still
have my procedure for that if you want it.
If you're working with a live file, it's a moving target.
All you can do is do 2 passes:
1. Walk thru the primary file and look up the indexed values to see
if they are really there. (Probably use SELECTINDEX find them.)
2. Walk thru the index and then read the primary record to see if
the indexed value is correct. Something like:
SELECTINDEX IDXNAME FROM FVAR TO 10
LOOP WHILE READNEXT IDXVAL FROM 10
SELECTINDEX IDXNAME, IDXVAL FROM F TO 9
LOOP WHILE READNEXT PRIMARY.ID FROM 9
READ REC FROM F, PRIMARY.ID
verify IDXVAL is correct.
REPEAT
REPEAT
Be careful to account for indexed multivalued data, where the primary
key might be listed more than once. See $OPTIONS PIOPEN.SELIDX.
___
For the newbies:
When we talk about accessing an index file directly (as opposed to
sanctioned SELECTINDEX, etc.), we mean doing an OPENPATH to that
type-25 file itself, or setting up a VOC pointer that points to it.
Be VERY hesitant to do this!!!
Typically if your data file is [dir]/ABC
the index is defined in a sibling director called I_ABC
Individual indexes would be [dir]/I_ABC/INDEX.000, INDEX.001, etc.
You would openpath or create an f-pointer to [dir]/I_ABC/INDEX.000.
By doing that you will have enabled yourself to do all kinds of damage.
cds
Is there a way to verify the indexes integrity of all files in Universe?
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users