User Tools

Site Tools


manual:advanced:map_tools:corrupted_sqlite

Corrupted SQLite Database Repair


SQLite databases on Android devices are very stable by definition. However, we have experienced that databases can be corrupted. This may be due to wrong closing the database or killing Locus app. The result is that Locus Map is not able to open the database file or the file deletes itself - this concerns both map files and points/track databases, all are SQLites. Luckily sometimes it is possible to repair such a corrupted database.

How to

Quick solution for MS Win users

This procedure concerns corrupted 'tracks.db' file that you can find in your Locus directory Locus/data/database:

  1. Download this .ZIP file and unpack it
  2. Copy tracks.db to the unpacked directory
  3. Run fix_tracks.bat
  4. copy repaired tracks.db to its original place (i.e. to Locus/data/database folder)

General solution

Following steps require working with the DOS command line (cmd).

  • Copy corrupted map file (or other sqlite database) from your device to PC
  • Download sqlite-tools from http://www.sqlite.org/download.html
  • Unpack it and place corrupted database file into the same directory as sqlite3.exe
  • Start “cmd” and navigate to the directory with the corrupted file
  • Run
>sqlite3.exe filename.db "PRAGMA integrity_check"

to verify database. Result will be probably error message Error: database disk is malformed.

  • Run
>sqlite3.exe filename.db ".dump" | sqlite3 new.db
  • If you repeat above integrity check on a new.db file, you should get “OK” message.
  • Rename new.db file to the original name of your file and copy it to its original place (i.e. copy fixed tracks.db or waypoints.db to Locus/data/database folder)

In case, above command failed, try alternative

>sqlite3.exe filename.db ".recover" | sqlite3 new.db

For example:

However, this procedure is not always successful. The easiest and most reliable way is to restore the database file from the backup.

manual/advanced/map_tools/corrupted_sqlite.txt · Last modified: 2022/08/23 08:29 by menion