User Tools

Site Tools


manual:advanced:map_tools:corrupted_sqlite

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:advanced:map_tools:corrupted_sqlite [2016/05/03 12:29]
mstupka
manual:advanced:map_tools:corrupted_sqlite [2019/01/22 08:18] (current)
Line 5: Line 5:
 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. 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 ===== ===== 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//:
 +  - Download **[[http://storage.asamm.com/locus/data/various/SQLite_tools.zip|this .ZIP file]]** and unpack it
 +  - Copy tracks.db to the unpacked directory
 +  - Run **fix_tracks.bat**
 +  - 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). Following steps require working with the DOS command line (cmd).
Line 14: Line 21:
   * Run   * Run
  
-<code>>sqlite3.exe new.db "PRAGMA integrity_check"+<code>>sqlite3.exe filename.db "PRAGMA integrity_check"
 </code>to verify database. Result will be probably error message Error: database disk is malformed. </code>to verify database. Result will be probably error message Error: database disk is malformed.
   * Run   * Run
  
-<code>>sqlite3 mydata.db ".dump" | sqlite3 new.db+<code>>sqlite3.exe filename.db ".dump" | sqlite3 new.db
 </code> </code>
   * If you repeat above integrity check on a new.db file, you should get "OK" message.   * If you repeat above integrity check on a new.db file, you should get "OK" message.
-  * Try to import the fixed database (i.e. copy fixed tracks.db or waypoints.db to Locus/data/database folder)+  * 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)
  
 For example: For example:
 {{ :manual:advanced:map_tools:sqlite_repair.png?nolink |}} {{ :manual:advanced:map_tools:sqlite_repair.png?nolink |}}
  
-<WRAP important round> However, this is not always possible. The easiest and most reliable way is to restore the database file from the backup. </WRAP>+<WRAP important round> However, this procedure is not always successful. The easiest and most reliable way is to restore the database file from the backup. </WRAP>
  
manual/advanced/map_tools/corrupted_sqlite.1462271368.txt.gz · Last modified: 2016/05/03 12:29 by mstupka