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 revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
manual:advanced:map_tools:corrupted_sqlite [2015/11/06 09:57] mstupkamanual:advanced:map_tools:corrupted_sqlite [2016/05/03 12:29] mstupka
Line 3: Line 3:
 ---- ----
  
-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 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 =====
  
-Following steps require working with the command line. +Following steps require working with the DOS command line (cmd).
  
   * Copy corrupted map file (or other sqlite database) from your device to PC   * Copy corrupted map file (or other sqlite database) from your device to PC
-  * Download sqlite-shell from http://www.sqlite.org/download.html +  * Download sqlite-tools from [[http://www.sqlite.org/download.html|http://www.sqlite.org/download.html]] 
-  * Unpack it and place corrupted database file into the same directory as sqlite3.exe  +  * 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+  * Start "cmdand navigate to the directory with the corrupted file 
 +  * Run 
 + 
 +<code>>sqlite3.exe new.db "PRAGMA integrity_check" 
 +</code>to verify database. Result will be probably error message Error: database disk is malformed.
   * Run   * Run
  
-  echo .dump | sqlite3.exe name_of_map.sqlitedb name_of_map_dump.sql+<code>>sqlite3 mydata.db ".dump| sqlite3 new.db 
 +</code> 
 +  * 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)
  
-  * and then+For example: 
 +{{ :manual:advanced:map_tools:sqlite_repair.png?nolink |}}
  
-  sqlite3.exe -init name_of_map_dump.sql name_of_map_fixed.sqlitedb+<WRAP important round> However, this is not always possibleThe easiest and most reliable way is to restore the database file from the backup</WRAP>
  
-  * Try to import the fixed map 
manual/advanced/map_tools/corrupted_sqlite.txt · Last modified: 2019/01/22 09:18 by mstupka