Thank you,
I believe this will help. Since my last email I took Rogers suggestion of 
looking over the structure of a database file and decided that if there is 
anything recovered from the .dump that it will need to be inserted into a 
database "template" in order to be functional.

The result was successful. I created a new database by importing the schema of 
a backup database that had not been corrupted like this;

.output Schema.txt
.schema

I then created a new database and set all of my user_version, journal_mode, 
etc. to match my original pre-corrupt specifications. Then I used .read to read 
in Schema.txt. This created an empty template database. Then I read in my dump 
file. The only errors were that the tables already exist but the insert into 
statements went through and my new database will launch in my application and I 
am able to recover the 3D symbols that were stored there and back them up.

It is not a 100% of course but it shows promise for future corrupt databases. I 
will test it on a few more of my client's databases and send an update of my 
findings.

Thank you all for your help,
~Kirk

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Thursday, August 05, 2010 4:40 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Repairing a Database.


On 4 Aug 2010, at 10:15pm, Kirk Clemons wrote:

> 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? 

We cannot tell what .dump will get from your old database because it is 
corrupt.  It might miss out lots of records.  It might appear to be doing all 
the records but actually put the same values in each one.  It might dump the 
entire database perfectly.

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

You can edit the file to replace 'INSERT' with 'INSERT OR IGNORE' or some 
variation on that.  See

<http://www.sqlite.org/lang_insert.html>

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

Reply via email to