ERROR: SQLite database is malformed 的解决方法

原文地址:http://froebe.net/blog/2015/05/27/error-sqlite-database-is-malformed-solved/

//检查数据
sqlite> pragma integrity_check;
Error: database disk image is malformed
//把数据dump出来
sqlite> .mode insert
sqlite> .output mydb_export.sql
sqlite> .dump
sqlite> .exit

//备份数据库
mv mydb.db mydb.db.original

//导入数据
sqlite3 mydb.db < mydb_export.sql
//重建索引
sqlite> analyze;
sqlite> .exit
This entry was posted in linux, Mac OS X.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">