Hello,

I'm using ADO.NET-Provider for SQLite (System.Data.SQLite, Version 1.0.80).
My database is password-protected. The password is passed in the connection
string.

Sporadically, I get the following exception:

Exception: The database disk image is malformed
malformed database schema (VALUE1) - near "VALUE2": syntax error

VALUE1 seems to be a value my application has recently added (or tried to
add) by means of an INSERT INTO statement issued by a SQLiteCommand.
VALUE2 might also be such a value, but I'm not sure.
VALUE1 and VALUE2 differ each time the problem occurrs.

Once this exception has occurred, it's impossible to open the database file.
Opening the database in Visual Studio Server Explorer produces the
following output:
---
SQLite error (1): near "08": syntax error
SQLite error (11): database corruption at line 93674 of [036395c0a8]
SQLite error (1): near "08": syntax error
SQLite error (11): database corruption at line 93674 of [036395c0a8]
SQLite error (1): near "08": syntax error
SQLite error (11): database corruption at line 93674 of [036395c0a8]
SQLite error (1): near "08": syntax error
SQLite error (11): database corruption at line 93674 of [036395c0a8]
SQLite error (1): near "08": syntax error
SQLite error (11): database corruption at line 93674 of [036395c0a8]
SQLite error (1): near "08": syntax error
SQLite error (11): database corruption at line 93674 of [036395c0a8]
SQLite error (11): malformed database schema (001) - near "08": syntax error
---

I suspect the SQLITE_MASTER table has been overwritten by the data which
should have been inserted into another table by the INSERT INTO statement
mentioned above.
I cannot verify that though, as I'm not able to open the database file any
more.
For the same reason, I cannot issue "PRAGMA integrity_check".

The application issues DDL and DML statements.
Sometimes, I also get the following error, but I don't know if it has to do
anything with the database corruption problem.
sqlite error (17): statement aborts at 21: [SELECT * [FROM MY_TABLE]]
database schema has changed
No exception is thrown for this error though. I get it in the
SQLiteConnection.Trace event only.

Now my questions are:
- What could have caused the database schema and database file to become
corrupt?
- Is there any chance to open the corrupt database file again? Most tools
(including SQLite3-CLI) fail to open even non-corrupted files, because they
do not support the encryption algorithm used by System.Data.SQLite, which
is RSA I think.
- Is it possible to decrypt a corrupted database file if it cannot be
opened by System.Data.SQLite any more?

Thank you in advance for any help.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to