zoukankan      html  css  js  c++  java
  • 【转】SQLite提示database disk image is malformed的解决方法

    SQLite有一个很严重的缺点就是不提供Repair命令。 导致死亡提示database disk image is malformed 它的产生有很多种可能,比如,磁盘空间不足,还有就是写入数据过程中突然掉电等。 官方对产生原因的一些说明: http://www.sqlite.org/lockingv3.html#how_to_corrupt

    (先要下载个sqlite3.exe:http://www.sqlite.org/download.html)

    sqlite  my.sqlite3
    sqlite>PRAGMA integrity_check;
    

    获得提示

    *** in database main ***
    Page 1518: btreeInitPage() returns error code 11
    On tree page 1566 cell 2: Child page depth differs
    On tree page 1566 cell 3: Child page depth differs
    SQL error: database disk image is malformed
    

    可以尝试通过简单的导出导入方式对损坏的库文件作回复。 首先导出数据

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

    再倒入到一个新库中

    sqlite3 mynew.sqlite3
    sqlite>.read tmp.sql
    sqlite>.quit
    

    这时新建的mynew.sqlite3一般可用。

  • 相关阅读:
    合并区间
    编译与运行
    传递信息
    划分字母区间
    无重叠区间
    用最少数量的箭引爆气球
    根据身高重建队列
    二叉树展开为链表
    动态添加按钮
    基础知识
  • 原文地址:https://www.cnblogs.com/netlyf/p/4586515.html
Copyright © 2011-2022 走看看