In the past two days, a client's sqlite data was damaged, so I will help him restore it.
Generally speaking, execute the following command with sqlite3 to fix it.
sqlite3 old.db .dump > newsfeed.sql
sqlite3 new.db < newsfeed.sql
But I tried several times, and the database after the repair was all 0KB.
After many twists and turns, I found that after the damaged database was dumped into sql, the last line became ROLLBACK;
Good guy, all rolled back for me.
Use emeditor to change ROLLBACK; to COMMIT;
Then execute sqlite3 new.db <newsfeed.sql
Alright haha, it's finally done, and I didn't disappoint the customers.
Source: http://www.cnblogs.com/iguor/archive/2012/08/23/2653442.html