Re: [sqlite] disk image malformed

2012-12-06 Thread sqdev sqdev
The several cases of corrupted databases i mentioned all resulted from a
newly created database.
I do not reuse repaired databases with my application.

The corrupted databases came from different computers and different users.


2012/12/6 Simon Slavin 

>
> On 6 Dec 2012, at 7:57pm, dd  wrote:
>
> > It's checking with OK, BUSY, 101 and some other errors. But not disk io,
> > image malformed errors. How to handle these errors in run time? these
> > databases have critical information about customers. We cannot stop
> > application. Any inputs?
>
> Proceeding after anything but SQLITE_OK, and the special result codes
> expected when you do sqlite3_step() will only make more problems.  The
> first time you get an error like DISK IO you have to stop.  Anything
> written to the database after that will probably fail, but if it doesn't
> fail it'll probably just corrupt the database file.
>
> But it's extremely unusual for users of SQLite to see errors 10 or 11.
>  They almost always indicates faulty hardware or that some part of your
> operating system has become corrupt (which might itself be the result of
> faulty hardware).
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] disk image malformed

2012-12-06 Thread sqdev sqdev
Please have a look at the post I mentioned:
I ran "PRAGMA integrity_check" in the shell tool (SQLite CLI) and got
errors, but still, they don't tell me what caused the corruption.



2012/12/6 Simon Slavin <slav...@bigfraud.org>

>
> On 6 Dec 2012, at 6:38pm, sqdev sqdev <sqdev...@gmail.com> wrote:
>
> > Maybe this post might be of interest here:
> >
> http://sqlite.1065341.n5.nabble.com/malformed-database-schema-td65610.html
> >
> > I had several corrupted databases the last few days. Unfortunately, I
> > haven't found out the cause yet.
>
> The answer, as always, is to try to open it in the shell tool.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] disk image malformed

2012-12-06 Thread sqdev sqdev
Maybe this post might be of interest here:
http://sqlite.1065341.n5.nabble.com/malformed-database-schema-td65610.html

I had several corrupted databases the last few days. Unfortunately, I
haven't found out the cause yet.


2012/12/6 Durga D 

> I will run integrity check.
>
> >>I would like to know, why sqlite throws disk io error while inserting
>  records...
>
> I suspect, linking among pages will  be broken in sqlite database when disk
> io error thrown by sqlite. Is it?
>
>
> On Thu, Dec 6, 2012 at 11:30 PM, Simon Slavin 
> wrote:
>
> >
> > On 6 Dec 2012, at 5:23pm, Durga D  wrote:
> >
> > > Is it (corruption) related error code 10? (disk io)
> > >
> > > I would like to know, why sqlite throws disk io error while inserting
> > > records...
> >
> > It doesn't matter.  Run an in integrity check:
> >
> > 
> >
> > If the integrity check reports a problem, rescue the data you can.  Throw
> > away the corrupt database and make a new one.
> >
> > If the integrity check doesn't report a problem, your error is very
> > unlikely to be related to a corrupt database.  Check your hardware and
> your
> > software.
> >
> > Simon.
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] malformed database schema

2012-12-03 Thread sqdev sqdev
I had several cases of corrupted databases in the last few days which all
look similar but not exactly the same:

sqlite> pragma integrity_check;
*** in database main ***
On tree page 45127 cell 9: Rowid 3 out of order (previous was 76)
Corruption detected in cell 9 on page 45127
Fragmentation of 12 bytes reported as 0 on page 45127
On tree page 45394 cell 1: Rowid 3 out of order (previous was 3)
On tree page 45394 cell 2: Rowid 3 out of order (previous was 3)
On tree page 45394 cell 3: Rowid 3 out of order (previous was 3)
...
On tree page 45394 cell 60: Rowid 3 out of order (previous was 3)
On tree page 45394 cell 61: Rowid 3 out of order (previous was 3)
On tree page 45394 cell 61: Rowid 3 out of order (min less than parent min
of 3)

Corruption detected in cell 61 on page 45394
Multiple uses for byte 292 of page 45394
On tree page 45124 cell 17: 2nd reference to page 45435
On tree page 45124 cell 17: Child page depth differs
On tree page 45124 cell 18: Child page depth differs
Page 45395 is never used
Error: database disk image is malformed

===

sqlite> pragma integrity_check;
*** in database main ***
On tree page 41236 cell 14: 2nd reference to page 41424
On tree page 41236 cell 14: Child page depth differs
Page 41474 is never used
sqlite> select * from RecentlyObjects;
{some records are displayed}
Error: database disk image is malformed
sqlite>

===

In all cases, the affected tables which are now corrupted, are frequently
changed by the following sql statements:
DELETE FROM table1;
INSERT INTO table1 SELECT * FROM table2;

I have tried to reproduce the error by means of a test programm which
stresses the database by issuing those statement in a loop.
Unfortunately, I have not been successful so far.
Probably, there is some other statement which is also relevant, and I do
not yet know.




2012/11/19 sqdev sqdev <sqdev...@gmail.com>

> 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


[sqlite] malformed database schema

2012-11-19 Thread sqdev sqdev
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