On 7 Nov 2013, at 11:50pm, Mayank Kumar (mayankum) <[email protected]> wrote:
> Are there known tools which tell us what data corrupted the db or some way of
> removing only the corrupted section of the db ?
Download the SQLite shell tool for your platform.
Use .dump to dump the database to a SQL command file.
Then use the same shell tool to create a blank database and .read those
commands to read that data back in.
We have no way of knowing how much, if any, of the data from the original
database this will recover. Take a look at the text file yourself and see if
you can figure out how much went missing.
> I will definitely look into the wal mode. Are there any test results for disk
> failure robustness of this mode compared to journal mode.
This won't help. As long as you're using a network file system which does not
support fsync() properly you will get more corruption. Is this database on the
hard disk in the computer running the SQLite application, or are you accessing
it across a network ? What OS and disk format are you using ?
>>> 1. rc = sqlite3_open("test.db", &db);
change your app to look at this result code and check that it equals SQLITE_OK.
And do the same thing with the result codes returned by all your other
sqlite3_ calls. If any of them are not SQLITE_OK report the value and quit.
>>> 1. when the db gets corrupt, I expect that the next read/write
>>> statement will look at the journal and recover from it .
Depends on the nature of the corruption. Some corruption can't be detected.
>>> So I see the journal file does gets deleted after the power is restored and
>>> the sqlite tries to write again, but the sqlite db is still corrupt. Is
>>> there a way to verify the rollback using the journal file was successful or
>>> not ?
Simply ignoring the journal file, or having had the journal file deleted should
yield an uncorrupted database. Possibly slightly out of date, but uncorrupted.
This is SQLite's fall-back situation. Apparently it's not working in your
case.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users