Re: [sqlite] SQLITE_CORRUPT: database disk image is malformed

2010-05-12 Thread Kees Nuyt
On Tue, 11 May 2010 13:05:10 + (GMT), kundan bharti
 wrote:

>Hello Sir/Maam,
>
> I am getting the error "SQLITE_CORRUPT: database disk image
> is malformed" while opening the attached database in
> SQlite Expert. 

Attachments usually don't make it in mailing lists, perhaps
you can put it on a website give us a link?
Do you get the same error with the sqlite3 command line
tool?

> Can you please tell me the reason as well as

To analyse the reason we would like to know in which
environment and with which sqlite3 version the database was
created.
One of the reasons could be deletion of a journal after a
failed transaction.

> a solution to rectify this issue.

First make a backup copy of the database file.
Try the  .dump  command in the command line tool.
If that doesn't return all your data you can try
 .dump tablename  for every single table separately.
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLITE_CORRUPT: database disk image is malformed

2010-05-11 Thread kundan bharti
Hello Sir/Maam,

I am getting the error "SQLITE_CORRUPT: database disk image is malformed" while 
opening the attached database in SQlite Expert. Can you please tell me the 
reason as well as solution to rectify this issue.

Thanks,
Kundan Bharti


  ___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLITE_CORRUPT - database disk image is malformed

2009-04-10 Thread Dan

On Apr 11, 2009, at 3:03 AM, Dave Toll wrote:

> Hello list
>
> I am sometimes seeing the error SQLITE_CORRUPT with message  
> "database disk image is malformed", when I attempt CREATE TEMP  
> TRIGGER. My test spawns 5 threads, each of which modifies and  
> queries its own table in a common database (each thread uses a  
> separate connection from sqlite3_open_v2() to the same filename with  
> shared cache enabled). The error occurs when one thread attempts  
> CREATE TEMP TRIGGER while another thread is closing its own database  
> connection (I have proved this by protecting all calls except these  
> with semaphores). Looking through the SQLite 3.6.12 amalgamation  
> code I found the following comment in sqlite3VdbeExec():
>
>  ** Although the mutex on the BtShared object that corresponds to
>  ** database iDb (the database containing the sqlite_master table
>  ** read by this instruction) is currently held, it is necessary to
>  ** obtain the mutexes on all attached databases before checking if
>  ** the schema of iDb is loaded. This is because, at the start of
>  ** the sqlite3_exec() call below, SQLite will invoke
>  ** sqlite3BtreeEnterAll(). If all mutexes are not already held, the
>  ** iDb mutex may be temporarily released to avoid deadlock. If
>  ** this happens, then some other thread may delete the in-memory
>  ** schema of database iDb before the SQL statement runs. The schema
>  ** will not be reloaded becuase the db->init.busy flag is set. This
>  ** can result in a "no such table: sqlite_master" or "malformed
>  ** database schema" error being returned to the user.
>
> Could this be the reason for the error I'm seeing? Is this a known  
> issue or expected behaviour? Do I need to protect DDL calls on  
> multiple connections to the same database, or this there some other  
> way to protect against this possibility?

No. SQLite does this internally. All you have to do is make sure
SQLite is compiled to be threadsafe. Call the sqlite3_threadsafe()
API at runtime if you are not sure.

If you have example code that can reproduce this, please file a bug
here:

   http://www.sqlite.org/cvstrac/tktnew

It sounds like this could use looking into.

Dan.



> Cheers,
> Dave.
> ___
> 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] SQLITE_CORRUPT - database disk image is malformed

2009-04-10 Thread Dave Toll
Hello list

I am sometimes seeing the error SQLITE_CORRUPT with message "database disk 
image is malformed", when I attempt CREATE TEMP TRIGGER. My test spawns 5 
threads, each of which modifies and queries its own table in a common database 
(each thread uses a separate connection from sqlite3_open_v2() to the same 
filename with shared cache enabled). The error occurs when one thread attempts 
CREATE TEMP TRIGGER while another thread is closing its own database connection 
(I have proved this by protecting all calls except these with semaphores). 
Looking through the SQLite 3.6.12 amalgamation code I found the following 
comment in sqlite3VdbeExec():

  ** Although the mutex on the BtShared object that corresponds to
  ** database iDb (the database containing the sqlite_master table
  ** read by this instruction) is currently held, it is necessary to
  ** obtain the mutexes on all attached databases before checking if
  ** the schema of iDb is loaded. This is because, at the start of
  ** the sqlite3_exec() call below, SQLite will invoke 
  ** sqlite3BtreeEnterAll(). If all mutexes are not already held, the
  ** iDb mutex may be temporarily released to avoid deadlock. If 
  ** this happens, then some other thread may delete the in-memory 
  ** schema of database iDb before the SQL statement runs. The schema
  ** will not be reloaded becuase the db->init.busy flag is set. This
  ** can result in a "no such table: sqlite_master" or "malformed
  ** database schema" error being returned to the user.

Could this be the reason for the error I'm seeing? Is this a known issue or 
expected behaviour? Do I need to protect DDL calls on multiple connections to 
the same database, or this there some other way to protect against this 
possibility?

Cheers,
Dave.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLITE_CORRUPT: database disk image is malformed

2007-08-11 Thread Joe Wilson
If you recompile sqlite3 with -DSQLITE_DEBUG=1, run sqlite3 in a 
debugger, and set a breakpoint on sqlite3Corrupt you can get
a stack trace showing what led up to SQLITE_CORRUPT.  
But although this will show you roughly where the file is corrupt, 
it probably won't help you with why.

If your OS is repeatably ceasing while running your app, you've 
probably got a hardware problem. Windows or not, this shouldn't happen.

--- Andrew Finkenstadt <[EMAIL PROTECTED]> wrote:
> Is there a good way/tool to determine what went wrong in a database file
> reporting SQLITE_CORRUPT?
> 
> The details I have so far are:  machine (running Windows XP) locked up hard
> while executing our application.  Repeatable hard-lock at a certain point.
> (Hard lock is defined as no mouse, no keyboard, no display update,
> necessitating reset button or power cycle.)
> 
> I've noticed that disk drivers will lie about whether data has been truly
> committed to physical media in the interests of passing a benchmark faster.
> I suspect something is going on here.



   

Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail=summer+activities+for+kids=bz
 

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] SQLITE_CORRUPT: database disk image is malformed

2007-08-10 Thread Andrew Finkenstadt
Is there a good way/tool to determine what went wrong in a database file
reporting SQLITE_CORRUPT?

The details I have so far are:  machine (running Windows XP) locked up hard
while executing our application.  Repeatable hard-lock at a certain point.
(Hard lock is defined as no mouse, no keyboard, no display update,
necessitating reset button or power cycle.)

I've noticed that disk drivers will lie about whether data has been truly
committed to physical media in the interests of passing a benchmark faster.
I suspect something is going on here.