Page 1 of 1

DB file malformed. Need help to repair.

Posted: Fri Jul 27, 2018 8:30 am
by Lector
I use my VRS running on Linux Debian 9 at RPi.
Recently I did find that reports from database caould not be retrived due to the reason "database disk image is malformed".
I've stopped the DB writer plugin, copied sqb-file to the windos PC and then tried to repair it with SQLiteFileRepair utility, but unsuccessfully.
I've put the screenshots of failed attempt with some report from the utility.
Need to say, that process of repair seemes to be running well itself, as the sql file is creating first and it looks as the proper one.
Then, journal and new sqb files are appear on disk and that sqb file is filling quickly with the new data. But process eventually stops at some point and removes all new files, along the giving an error message in the utility's window.
Could someone help me to fix this problem, as I'm not experienced well in sql?

P.S. In fact, I can't load the images into attachment, getting the status "ERROR
Error parsing server response." for each file.

Re: DB file malformed. Need help to repair.

Posted: Wed Aug 22, 2018 8:27 pm
by agw
Sorry for the delay in replying. I'm afraid the short answer is that if the file repair utility can't recover the file then there isn't much that I can do. The utility just automates what I do when I'm asked to recover SQLite files, which is it dumps the data out of the broken file, creates a new SQLite database and imports the data into that. That works fine if the damage to the file is just a knackered index or something but if the damage is enough to stop it from dumping the data out of the file then it's not going to work.

The only thing I could do is dump what I can and then import that, but it's going to be random as to what you're left with and what you will lose.

Re: DB file malformed. Need help to repair.

Posted: Thu Aug 23, 2018 5:40 pm
by Lector
Hi agw, I'm really glad you have responded.
The database is still collecting and the db-file itself is filling up.
The only wrong thing with it is that I do not see any records for the first/last track points and passing time in it.
It is only contains an aircraft appearance itself, but no movement data.
Could you check the file I have and maybe scrape away any corrupted data?
Doesn't matter, if some records might be lost. I do interested in repair technology, which could help not only in my case, but also for any users, who might have the same problem.

Re: DB file malformed. Need help to repair.

Posted: Thu Sep 13, 2018 10:16 pm
by agw
If you zip up the file, copy it to Dropbox (or similar) and email me the URL for it then I'll take a look.

Re: DB file malformed. Need help to repair.

Posted: Wed Oct 03, 2018 5:36 pm
by Lector
Oops, just found recently a new reply from agw here in topic.
Thanks for suggestion!
I did fix my DB last night with a few simple steps.
Thanks to SQLiteFileRepair utility, it is creates a sql-script that represents the whole DB in the readable form from up to the bottom without needing the loading to DB editors and then scrolling it row by row or selecting the bunch of data from the specific tables.
So I found that some rows in it are shuffled and overplaces the others. In fact, the messages in the utility's window tells about that quite clearly (see above screenshots).
I've opened the sql-script with text editor, found the rows that broke the order and then sorted them in necessary ascending order (linux utility 'sort' did that job).
Finally, corrected sql-script has been executed for newly created DB with the aid of sqlite3 command, like follow:
db_new.sqb <db_old.sql
Anyway, the SQLiteFileRepair utility itself did the main job as it produced the working script and pointed very closely to the places where the DB corruption occured enclosing it by the messages "/**** ERROR: (11) database disk image is malformed *****/"

The good advantage for the mentioned utility could be the possibility to create the sql-scripts (also) from working databases for the backup purposes and also function of using such scripts as the source file for the creations of new database from the scratch.
Dear agw, could you think about my suggestion?