Re: Other than header ! (Paradox)


[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]

Posted by webmaster Guido on June 17, 2002 at 17:44:48:

In Reply to: Other than header ! (Paradox) posted by Shahab Sharif (1) on May 24, 2002 at 08:04:14:

: When a paradox database close abnormal , I recieved this error message : "Currupt file - Other than header"
: Can i currect and retrive database again ?
: I read database record by record and make another DB file but lase records not found . (RecordCount is grather than my DB)
-----------

This is typical for most types of database files -- any type of database, not only Paradox. When the machine is switched off, or when any other failure happens before the database file is closed while the file was still open, then it can be corrupted. That's because most changes to the disk file are only written when you close the database file (until then, the changes are kept in an internal buffer).

Alas, automated repairs of a corrupted Paradox file is not possible. Data that are not there can not be recreated, and what has been damaged is gone forever. And even manual repairs of a corrupted Paradox file is very difficult and often impossible: how can you know what data *should* be there?

When only the indexes are corrupt, you can repair them manually with the aid of Delphi's DBD program(Database Desktop). Usually "packing" the db is enough, but sometimes you have to erase the index and then define it again in the DBD. Of course, this last part only works if you know the database structure.

Tips:

1. You can lower the risk of corrupted databases by opening the file for writing for a very short time only. I.e., open the file, change the data, close the file. Closing the file automatically writes all changes to disk.

2. Less dractic: "flush" the buffers after each change of data, this means: force a disk update with a command in your program after every editing. This leaves the file open, it doesn't slow down the program as much as method 1.

3. Always have good backups of the database, incase all other stuff fails ;-)


Related Articles and Replies:


[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]