Sqlite修复方法(database disk image is malformed)

    技术2022-05-19  20

    转自:http://hi.baidu.com/9562512/blog/item/81932e3e432bc33770cf6cd4.html

     

    遇到 sqlite3 数据库错误 “database disk image is malformed”,G 了一下,搞定,遂记录,帮人帮己。运行PRAGMA integrity_check;发现*** in database main ***On tree page 120611 cell 0: 3 of 4 pages missing from overflow list starting at 120617On tree page 120616 cell 0: 3 of 4 pages missing from overflow list starting at 120621On tree page 3309 cell 0: 3 of 4 pages missing from over假设原数据库名 abc.db运行命令(需要sqlite3命令行工具,可从官方下载http://www.sqlite.org/download.html)

     

    sqlite3 abc.db.output “_abctemp.tmp”.dump.quit

     

     

    再建个新数据库 abc2.db

    sqlite3 abc2.db.read “_abctemp.tmp”

    .quit

    删除abc.db, mv abc2.db abc.db

    然后修复原来的数据库名和文件权限,应该就没事了。


    最新回复(0)