sqlite or svn 錯誤 The database disk image is malformed 可解決


在網上找了很多資料,很多網友都提到這個問題是不可解決的,面對這個問題,只能作罷。

但我不甘心這么丟失數據,最最后找到了一個解決方法。經測試,原來數據,全部保住。

以下為原文。

http://www.sunnyu.com/?p=201

 

SQLite有一個很嚴重的缺點就是不提供Repair命令。 導致死亡提示database disk image is malformed 它的產生有很多種可能,比如,磁盤空間不足,還有就是寫入數據過程中突然掉電等。 官方對產生原因的一些說明: http://www.sqlite.org/lockingv3.html#how_to_corrupt

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一般可用。

http://www.cnblogs.com/yelaiju/archive/2011/03/27/1996863.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM