SQLite:database disk image is malformed[附损坏文件下载]

2012-04-20大清早的醒来,准备上网查下资料,不料长城宽带给我断网。 于是乎就在本地看我网站里的一些资料。

本地的环境:xpsp3+apache2.2.21+php5.3.8+pdo_sqlite

看了几篇文章后,网站突然出现:database disk image is malformed。然后整个网站都无法打开。于是就开始查数据库,用sqlitespy可以打的开呀,各个表都点了一下,数据都有,又返回刷新网站,还是错误,于是又去找类报错的地方,把sql语句也打出来,放到sqlitespy里运行,奇怪,有些可以正常运行,有些直接报错且sqlitespy弹出错误框database disk image is malformed,刚开始把错误定位在addtime上,因为用的是date current_timestamp类型的数据,发现用order by addtime后会弹出错误提示框,但数据还能列出来。于是又怀疑是content内容有问题,因为是文章嘛,数字自然多,出问题的可能性大,于是在content从第一条记录一直往下看,直到175时,sqlitespy不停地弹错误框,而且看到有两条记录ID为175,晕呀,我的ID是主键,而且是自增长的,真是奇怪,以前都好好的。今天怎么这样了。只能从进程里把sqlitespy结束掉。

重新打开数据库,然后删掉ID为175的记录,接着继续从第一条记录往下看,又到了174开始弹错误框,晕,又两个ID为174的记录,又结束进程。重新打开,估计是错误出在175附近,虽然175删掉了,那个错误空隙可能会前后移动。于是:
insert into t(xx1,xx2,xx3) select xx1,xx2,xx3 from info where id not in(173,174,175,176);
alter table info rename to info_ttt;
alter table t rename to info;
OK,到此后就可以正常工作了。

又继续那个错误的表,使用select ID from info_tttt可以正常查看记录,但使用select * from info_tttt会报错误,还是到174处断掉了。而且数据库无法vacumm。

等待sqlite团队回信,看怎么说吧。

help:database disk image is malformed
Hi, sqlite team:
   Do you know "database disk image is malformed" how to happen???
   I use sqlite3 as my web database, but today, it says "database disk image is malformed" and I can't open my website.
  
   my localhost web site environment:xpsp3+apache2.2.21+php5.3.8+pdo_sqlite.
   I found one table has two same ID,and ID's create statement is:primary key autoincrement. I delete this ID, but then the previous ID will become two same ID. It is strange. Then I delete the same ID, but also have problem with next ID, see the attachment, you can use sqlitespy.exe to open the attachment database[tt_bad_one-table_less_data.sql].  you can use sql:select ID from into_tttt, but can't use select * from into_tttt. 
  
   Though this link: http://hotfile.com/dl/153478413/b58e245/tt_bad_one-table_less_data.7z.html, you can download it.
  
  
   Can you tell me how does this happen ??  How to solution this problem????

   Thank you very much!

发现问完了,谷哥一下,居然有答案,汗。算了,http://www.sqlite.org/faq.html#q21里面提到millions of users,这么快就让我给撞上了。谁想玩下,看下的,http://hotfile.com/dl/153478413/b58e245/tt_bad_one-table_less_data.7z.html试试手,别搜索答案,看自个能不能解决。 我是牺牲了4条数据解决好的。没想到还有更好的方法。


还有一招最好的就是.dump数据,然后再sqlite3.exe xxx.sqlite < dump后的文件,就可以恢复了。


300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00478 秒