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

转自: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 120617
On tree page 120616 cell 0: 3 of 4 pages missing from overflow list starting at 120621
On 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
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值