Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sqlite Database Browser crahses - how to restore the DB with journal file

Tags:

sqlite

journal

I worked on my sqlite Database with the program "SQlite Database Browser". The program crashed and I lost my changes. But the db-journal file is still there. How can I recover the database with the journal file? When I open the database with the SQLite Database Browser the old database opend.

What can I do?

Thanks :-)

like image 818
cuSoon2013 Avatar asked Oct 22 '11 10:10

cuSoon2013


1 Answers

Unless you enabled Write-Ahead logging, I'm afraid that your changes are probably lost. The default journalling system in SQLite works in the opposite way than you are expecting.

From the documentation:

The traditional rollback journal works by writing a copy of the original unchanged database content into a separate rollback journal file and then writing changes directly into the database file. In the event of a crash or ROLLBACK, the original content contained in the rollback journal is played back into the database file to revert the database file to its original state.

See:

WAL: https://sqlite.org/wal.html

File formats, including journals: https://sqlite.org/fileformat.html

like image 134
bsa Avatar answered Nov 05 '22 05:11

bsa