Sqlite malformed database

From GRASS-Wiki
Revision as of 10:11, 30 June 2016 by Lucadelu (talk | contribs) (create page how to restore malformed sqlite database)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sometimes can happen to get this error using vector data

DBMI-SQLite driver error:
Error in sqlite3_step():
database disk image is malformed

DBMI-SQLite driver error:
Error in sqlite3_step():
database disk image is malformed

To solve this you can only recreate the database in a new one.

You have to move in the directory of SQLite database inside your GRASSDATA/LOCATION/MAPSET/sqlite, access sqlite.db and run

sqlite> .mode insert
sqlite> .output dump_all.sql
sqlite> .dump

Now you have to rename sqlite.db to something else (e.g. sqlite.db.old). Create a new empty database called sqlite.db, access it and run

sqlite> .read dump_all.sql