PDA

View Full Version : When good indexes go bad...


ABC123

Charlain
10-24-2003, 06:56 AM
I just survived a very frightening experience & wonder if anyone can tell me what might have caused it.

I zipped my database (using Tools/Zip Database). I did not include all the tables in the zip and had Compression option checked.

After running the zip procedure, I noticed a search script that has been working great for months started retrieving the wrong record.

I decided to update the index for the customer table to see if it would help. The search routine begain retrieving the correct record again.

Then, I noticed that on a printout, the wrong address was being printed out for each customer.

Somehow the customer number (linking field between customers and addresses) had begun matching the wrong customer with the wrong address.

So, I updated the index on the address table, and the problem was corrected.

I subsequently ran an update on each table in the entire database.

I don't want this to happen again, so can anyone tell me what might have happened so that I can take whatever steps are necessary to avoid this in the future?

Thanks,

Charlain

Stan Mathews
10-24-2003, 07:09 AM
It isn't clear whether you zipped up your database, expanded it in a new location, and had trouble with the new copy or whether you zipped up your database, maybe as a backup, and then had trouble with the original.

If the former is the case, it would seem that you didn't have the index files in the new location.

If the latter is the case, I can think of no reason for an untouched original database to be changed by a zip process.

If you look at the tables/sets tab of the control panel is the pathe the same for all entries?

kumargroup
10-24-2003, 07:10 AM
It is almost impossible to tell precisely what causes indices to fail. There might really be two options...

* Update indices at a specified time each day/week, etc.
* Update indices before you run any critical processes/reports, etc. (like your customer report) before printing the report.

There is also a nice TEST INDICES feature that tells you if the indices are in sync with the dbf.

Kris

Charlain
10-24-2003, 07:16 AM
Stan,

It was the original database that became corrupt after I zipped it. Weird, huh?

Charlain

Charlain
10-24-2003, 07:17 AM
Thanks, for the info Kris -- I wasn't aware of the Test Indices procedure. I will check it out.

Charlain

djones092
10-24-2003, 11:52 AM
Kris:

Can you expand on this? Is this an XBasic command? If not, do you know if it's available in A4v7?

JerryBrightbill
10-24-2003, 12:15 PM
Denis

There were a couple xbasic functions introduced in A5V5 build 1403 for testing indexes. They are covered in the release notes for A5V5. I don't think there are any equivalent methods in other versions.

Jerry

Melvin Davidson
10-24-2003, 12:22 PM
From the release notes:

New Features
a5_CheckIndexesDialog() Function – Displays a dialog box
showing all of the tables in your database. From this
dialog you can check the integrity of the indexes for all
tables in the database, or just check the integrity of
indexes for a single table.

Check_indexes_for_table() Function – Checks the integrity
of an index for a specific table.
Returns .t. or .f., depending on whether the index is valid
or corrupt.

djones092
10-24-2003, 12:27 PM
Cool.

Thanks Jerry.

djones092
10-24-2003, 12:27 PM
Thanks...