Sqlite malformed database

From GRASS-Wiki
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