Page 1 of 1

[Tutorial] Recovering a damaged odb file

PostPosted: Thu Apr 02, 2009 8:45 am
by r4zoli
Power cut can cause data loss. The database part of an odb file sits in memory during edit process, and then is packed back into the file when the work is finished .

If your file opens in Writer and asks for coding selection, your file damaged. To restore it, you can try the following process.

Make a copy of your .odb file (to keep the original file) and change its extension to .zip.

If you can open the file with zipper program then there are some chances that you can retrieve your data.
If your file cannot open in zipper program, your data is probably lost.

When you open the file in the archive manager, you should see the following structure:
odb file structure.
(It is Hungarian version, but I hope you can match it to your system)

Go to the database folder, you should see these files:
Database folder.
database_folder.PNG (1.2 KiB) Viewed 27716 times

Extract the script and data files.

Open the script file, look for any discrepancies, and try to repair them.

Create new empty odb file, open it with an archive manager and overwrite the script and data files with the ones of the old file.

Close that new file and rename it back to .odb, you should now be able to work with it.

Re: [Tutorial] Recovering a damaged odb file

PostPosted: Thu Dec 03, 2009 9:35 am
by r4zoli
To be more clearer I describe the HSQLDB database engine work(it is derived from HSQLDB documentation).

A database folder can consists of between 2 to 5 files (what you can see my earlier post):
How HSQLDB works within odb file
The properties file contains a few settings about the database.
The script file contains the definition of tables and other database objects, plus the data for non-cached tables.
The log file contains recent changes to the database.
The data file contains the data for cached tables and the backup file is a compressed backup of the last known consistent state of the data file.
All these files are essential and should never be deleted. For some files, the data and backup files will not be present. In addition to those files, a HyperSQL database may link to any formatted text files, such as CSV lists, anywhere on the disk.

While the odb file is open, a log file is used to write the changes made to data. This file is removed at a normal SHUTDOWN during file closure. Otherwise (with abnormal shutdown) this file is used at the next startup to redo the changes. A lck file (not in database folder, but in a file system next to the odb file)is also used to record the fact that the database is open. This is deleted at a normal SHUTDOWN.

When the engine closes the database at a shutdown, it creates temporary files with the name new which it then renames to those listed above. In some circumstances, a data.old is created and deleted afterwards. These files should not be deleted by the user. At the time of the next startup, file opening all such files will be deleted by the database engine.

Re: [Tutorial] Recovering a damaged odb file

PostPosted: Tue Aug 23, 2016 6:38 pm
by arfgh
i cant understand how the db files get corrpted at unknown times, even with the last AOO version. Maybe the ones that work on it, just dont want that we have stable database files, or i dont know, but the problem is very well knows since YEARS !! what a shame.