Restoring measurements from crashed database of Tower Collector
Posted by Kolesár on 29 July 2015 in English.I’m an OpenCellID contributor. I use Tower Collector application on Android phones for recording cell data. I have recorded data for more than 500,000 locations.
One day one of my phones has shut down on a trip after 80 kilometers which I will never do again. I have checked Locus where the tracklog stopped: a few kilometers behind. Started Tower Collector, it showed zero locations! Oh my god. I had another trip previous day which was not uploaded yet.
This device was rooted, started root browser, checked the application’s data directory:
/data/data/info.zamojski.soft.towercollector
In directory “databases” I have seen an empty measurements.db (a few kB), but there was another file: measurements.db.back with 600 kB! Made a backup copy of the whole directory and resumed my route.
At home I have checked the db. It is an sqlite database, but has been corrupted.
sqlite> pragma integrity_check;
Error: database disk image is malformed
I have made a dump of the database:
echo .dump | sqlite3 measurements.db.back > measurements.sql
There were 2059 measurements for 76 cells, valuable data. How to restore them? Load back to Tower Collector. I did not have time for that for weeks, but continued collecting new data. I was frustrated because this phone did not remember the cells collected before the crash, displayed a most of cells as new. I have also missed the data from that two trips. Some weeks later I have tried to load data.
At first I have created a new database using the recovered data but I have failed many times. I replaced measurements.db with the new one, app crashed (SQLiteCantOpenDatabaseException). Checked directory and file permissions via Root Browser, it showed root as owner of every file, but later I have checked the same thing via adb and it showed totally different owners: every app has a userid and owner should be set correctly.