Also, does this mean that I could take a backup copy of my database and import 
the data that is retrieved from the .dump command on the corrupt database? 

If so how would I do this and get past the PRIMARY KEY/existing table errors?

~Kirk

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Roger Binns
Sent: Tuesday, August 03, 2010 5:56 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Repairing a Database.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/02/2010 07:42 AM, Kirk Clemons wrote:
> I have seen some information on repairing a corrupt database and recovering 
> at least some of the data. But I have not had any luck finding out how to do 
> it.

You can use .dump in the shell.  It does a 'select *' on each table
outputting the rows (which will be in rowid order).  If it gets
SQLITE_CORRUPT then it repeats the select, but in reverse rowid order so in
theory you'll get the rows before and after the corruption.

In general you cannot repair or recover a corrupt database because to do so
would mean that information has to be stored redundantly - ie you could use
a duplicate to reconstruct the original.  The one exception is that indices
can be dropped and recreated since they are redundant.

The file format information will be most helpful.  The two documents
describe the same thing but with different styles.

  http://www.sqlite.org/fileformat.html
  http://www.sqlite.org/fileformat2.html

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxYup8ACgkQmOOfHg372QTYuwCg2GpSzG5qzltWQliyplKyPU2r
sTAAnROPV+qQcmhouUl9/z6RLDMnTMjm
=fvzY
-----END PGP SIGNATURE-----
_______________________________________________
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

Reply via email to