SQLite : database disk image is malformed 处理一例

报 QSqlError(“11”, “Unable to fetch row”, “database disk image is malformed”),网上查找资料,解决办法记录如下

D:\>sqlite3 ProductionData.s3db
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> PRAGMA integrity_check;
*** in database main ***
Main freelist: freelist leaf count too big on page 8808764
Main freelist: invalid page number 167772160
Page 13865 is never used
....以下略

继续输入命令

sqlite>.output tmp.sql
sqlite>.dump
sqlite>.quit

然后新建一个文件,导入,再检查就已经OK

D:\>sqlite3 ProductionData~.s3db
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> .read tmp.sql

sqlite> PRAGMA integrity_check;
ok
sqlite> .quit

D:\>

 

参考:

  • 修复SQLite-database disk image is malformed
    http://www.cnblogs.com/adinet/archive/2011/11/03/2233858.html
  • SQLite出现database disk image is malformed(11)的处理
    http://www.sunnyu.com/?p=201

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.