What to do with a .journal file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

What to do with a .journal file

Robert Weiss
I had a process that was writing a sqlite database when the computer crashed. I now have two files: f6.db and f6.db-journal. How do I get the information in the journal file to be incorporated in the database? 
I tried open f6.db in the sqlite3 console program, and afterwards the journal file is still there.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: What to do with a .journal file

Simon Slavin-3
On 18 Aug 2019, at 6:10pm, Robert Weiss <[hidden email]> wrote:

> I had a process that was writing a sqlite database when the computer crashed. I now have two files: f6.db and f6.db-journal. How do I get the information in the journal file to be incorporated in the database?
> I tried open f6.db in the sqlite3 console program, and afterwards the journal file is still there.

That's okay.  You did the right thing.  If you use the console program to make a change to the database, then close it by quitting the SQLite CLI, /then/ the journal file may disappear.

Do not delete, move or rename the journal file yourself.  That will definitely make things worse.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: What to do with a .journal file

Keith Medcalf
In reply to this post by Robert Weiss

On Sunday, 18 August, 2019 11:10, Robert Weiss <[hidden email]> wrote:

>I had a process that was writing a sqlite database when the computer
>crashed. I now have two files: f6.db and f6.db-journal. How do I get
>the information in the journal file to be incorporated in the
>database?

>I tried open f6.db in the sqlite3 console program, and afterwards the
>journal file is still there.

You probably did not actually "open" the file.  The sqlite3_open* calls are lazy.  The database files are not actually opened until they are needed for something, like you attempt to read or write from the file.  The following does not actually "open" the file "test.db":

sqlite3 test.db
sqlite> .q

However, the following will, since it requires actually reading something (the schema) from the database file, and to do that it must actually be opened:

sqlite3 test.db
sqlite> .schema
sqlite> .q

--
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.





_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users