On 2018/12/05 5:20 AM, Ryan Schmidt wrote:
Hello,

I have a corrupt SQLite database about which I'd appreciate your advice. The 
data is not critical but I'd like to fix it if it's possible and not too 
time-consuming. Even just knowing why the problem occurred or how to prevent it 
in the future would be helpful. If there's something the application should be 
doing differently in its use of the SQLite library to ensure the database 
doesn't get corrupted that would be good to know.

The application that is using the SQLite library (MacPorts) is experiencing 
this error://....

Hi Ryan, the question has two parts:
1 - Can it be fixed?
Very probably - by simply dumping it to text and re-importing again. It may need a scan by eye to make sure there are no serious broken text, but usually the Index errors as per your error dump will not be too complicated and easily/automatically corrected.
See the .dump command in the sqlite CLI documentation:
https://sqlite.org/cli.html#converting_an_entire_database_to_an_ascii_text_file


2 - How did it happen?
Hard to say, almost certainly a write that somehow didn't make it to the physical layer. Here is a list of why that can happen (which you may have already encountered in your research):
https://sqlite.org/howtocorrupt.html


Good luck!
Ryan

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to