Re: Re: [sqlite] database corrouption during power failure

2006-10-25 Thread jayanth KP
Thanks Dennis Cote. Now even though synchrounous is set to FULL. But Database 
Corrouption is happening.  Here are my observations in our sqlite 2.8.13.

1. This corrouption is not detected by the sqlite_open().

2. After the crash/power failure. I see a journal file in the same directory as 
the database file. This means the database can be rolled back. I analyed the 
journal header and checksum, it looks fine.

3. Now before the rollback if i copy the database file to a different directory 
and open using sqlite. None of the tables are seen.

4. Now if i do a sqlite_open(), the rollback of the orginal data does not 
happen. But the journal file is removed.

I am suprised how can journal be be present and still database corruption 
happen.. 

Please help me resolving this issue.

Bye
Jayanth


On Mon, 23 Oct 2006 Dennis Cote wrote :
>jayanth KP wrote:
>>But how do we read the current  synchronous value using C interface. Plz 
>> reply.
>>
>> 
>Jayanth,
>
>Try this:
>
>sqlite3_stmt* s;
>sqlite3_prepare(db, "PRAGMA SYNCHRONOUS", -1, &s, NULL);
>sqlite3_step(s);
>int sync = sqlite3_column_int(s, 1);
>sqlite3_finalize(s);
>
>switch (sync) {
>case 0: // off
>case 1: // normal
>case 2: // full
>}
>
>
>It simply executes the PRAGMA and collects the result.
>
>HTH
>Dennis Cote
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-23 Thread jayanth KP
Hi Dennis Cote,

   But how do we read the current  synchronous value using C interface. Plz 
reply.

Regards
Jayanth


On Mon, 16 Oct 2006 Dennis Cote wrote :
>jayanth KP wrote:
>>Thanks for ur reply. I searched in the whole source code i could not find 
>> SQLITE_NO_SYNC flag. 
>>Also i tried the following in my c code, after sqlite_open() was success.
>>sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, &pErrMsg);
>>
>>Even this did not seem to work. How do i check if this PRAGMA is working fine 
>>from my code.
>>
>>
>> 
>
>The pragma commands are documented at http://www.sqlite.org/pragma.html. To 
>check the current value simply execute a "pragma synchronous" command. The 
>current setting will be returned. In your case it should be 2 for FULL 
>synchronous operation.
>
>The SQLITE_NO_SYNC flag is a define that can be passed to the compiler while 
>buiding your code. Look in your makefile or your compiler's options setting 
>dialog for -DSQLITE_NO_SYNC.
>
>HTH
>Dennis Cote
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-16 Thread jayanth KP
Hi Richard,

   Thanks for ur reply. I searched in the whole source code i could not find 
SQLITE_NO_SYNC flag. 

Also i tried the following in my c code, after sqlite_open() was success.
sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, &pErrMsg);

Even this did not seem to work. How do i check if this PRAGMA is working fine 
from my code.

Please help me in solving this issue

Regards
Jayanth








  


On Fri, 13 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi Richard,
> >
> > We are ALREADY using sqlite 2.8.13.
>
>Your original post said you were using 2.8.3.  Must have
>been a typo.
>
> >
> > OBSERVATIONS:
> > -
> >
> > 1) If i call sync() system call after database update, the database is not 
> > getting corrupted.
>
>SQLite calls sync() twice during each COMMIT,  unless you have
>it disabled.  My guess is that you must be doing
>
>PRAGMA synchronous=OFF;
>
>Or perhaps you are compiling with -DSQLITE_NO_SYNC=1.
>
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-13 Thread jayanth KP
Hi Richard,

We are ALREADY using sqlite 2.8.13.

OBSERVATIONS:
-

1) If i call sync() system call after database update, the database is not 
getting corrupted.

2) In one scenario of corruption sqlite_open() returned an error message "file 
is encrypted or is not a database".

3) In another scenario sqlite_open() did not detect the corruption. But any 
subsequent calls is not successful. For example if we start sqlite application 
and run .tables , nothing is returned.


Thanks and regards
Jayanth
  


On Fri, 13 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> >Please can anybody respond to this question. I am able to hits is issue 
> > pretty often now...
>
>In my previous response, reproduced below, I showed you the
>cause of the problem and how to fix it.  What further response
>do you want?
>
> >
> > > >
> > > > Please help me in solving this issue
> > > >
> > >
> > >See http://www.sqlite.org/cvstrac/tktview?tn=599
> > >
> > >This problem was fixed in SQLite version 2.8.12, over two
> > >and a half years ago.
> > >
> > >--
> > >D. Richard Hipp  <[EMAIL PROTECTED]>
> > >
> > >
> > >-
> > >To unsubscribe, send email to [EMAIL PROTECTED]
> > >-
> > >
>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-13 Thread jayanth KP
Hi,

   Please can anybody respond to this question. I am able to hits is issue 
pretty often now...



Regards,
Jayanth  


On Fri, 06 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >I have a question regarding power failure handling in sqlite 2.8.3.
> >
> > When the power is switched off during  a database write like 
> > (insert/update), in next reboot database is getting corroupted.
> >
> > The database is in a ext3 partition on the harddisk (linux 2.6).
> >
> >
> > Also i tried the following in my c code after sqlite_open() was success.
> >
> > sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, &pErrMsg);
> >
> > This did not seem to work.
> >
> > Please help me in solving this issue
> >
>
>See http://www.sqlite.org/cvstrac/tktview?tn=599
>
>This problem was fixed in SQLite version 2.8.12, over two
>and a half years ago.
>
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-06 Thread jayanth KP
Hi Richard,

   Sorry, i gave a wrong version number of sqlite . We are using sqlite 2.8.13.

OBSERVATIONS:
-

1) If i call sync() system call after database update, the database is not 
getting corrupted.

2) In one scenario of corruption sqlite_open() returned an error message "file 
is encrypted or is not a database".

3) In another scenario sqlite_open() did not detect the corruption. But any 
subsequent calls is not successful. For example if we start sqlite application 
and run .tables , nothing is returned.


Thanks and regards
Jayanth






  


On Fri, 06 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >I have a question regarding power failure handling in sqlite 2.8.3.
> >
> > When the power is switched off during  a database write like 
> > (insert/update), in next reboot database is getting corroupted.
> >
> > The database is in a ext3 partition on the harddisk (linux 2.6).
> >
> >
> > Also i tried the following in my c code after sqlite_open() was success.
> >
> > sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, &pErrMsg);
> >
> > This did not seem to work.
> >
> > Please help me in solving this issue
> >
>
>See http://www.sqlite.org/cvstrac/tktview?tn=599
>
>This problem was fixed in SQLite version 2.8.12, over two
>and a half years ago.
>
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>