How to repair corrupt sqlite databases

In 321Run I use sqlite to keep all data. It's a 2.0 app, and I never migrated to coredata... and probably never will.

From time to time, a user contacts me because their database is empty: no more history, and all former runs (sometimes more than 200) have disappeared.

It's usually a corrupt database problem.

What I do now is ask for the file itself (it's available through iTunes file sharing), and then try to repair it. This command has usually given very good result:

echo ".dump" | sqlite3 trainer.sqlite | sqlite3 trainernew.sqlite

Cool, heh? Hope it works for you if you have the same kindof issue.

If you are a user, please contact me so I can try, as it's not certain it will work and is more for the expert user.

Publié le 18 Sep 2011
Écrit par Cyril