Delete Database file?
Mick Sulley
mick at sulley.info
Wed Nov 23 20:16:49 GMT 2016
Yes I have investigated and 'mended' it. The big problem with this sort
of thing is that you can never be sure if you have lost anything. I
found some info on this link
http://stackoverflow.com/questions/13675615/svn-cleanup-sqlite-database-disk-image-is-malformed
In case anyone else has a similar problem here is what I did -
run sqlite3 to check integrity, best copy digikam4.db to a temp
directory, go to that directory and run -
sqlite3 digikam4.db "pragma integrity_check"
if this returns 'ok' then there is no problem.
If it returns errors
sqlite3 digikam4.db
sqlite> .mode insert
sqlite> .output dump_all.sql
sqlite> .dump
sqlite> .exit
then restart on a new database
sqlite3 new.db
sqlite> .read dump_all.sql
sqlite> .exit
This has now created a new database file that should have everything
that was recoverable from the original. Rename the existing and use
this new one to replace it.
I had previously tried just deleting (renaming to backup) the database
and restart re-created it. Comparing the 3 databases, original, auto
created and rebuilt as above, I saw these results for a couple of tables
ImageInformation orig = malformed error, auto = 22028, rebuilt = 47195
ImageMetadata orig = 46949, auto 21310, rebuilt = 46948
So my conclusion is that the rebuilt database has recovered more of my
data and that is the one I have used. It is of course possible that the
additional records in rebuilt over auto are all rubbish and there was no
advantage, but I have no way to know that so used the bigger one.
Hope that helps someone.
Mick
On 21/11/16 19:16, Boudewijn wrote:
> Can you access the old database with a sqlite-tool? Maybe there's an
> option to dump tables to text and import it to the new one. Of course,
> work on a copy of the original database.
>
> Best regards,
>
> Boudewijn
>
>
> On November 19, 2016 12:34:35 PM GMT+01:00, Mick Sulley
> <mick at sulley.info> wrote:
>
> I have run self check on the disk and it seems fine.
>
>
> On 17/11/16 21:26, Maik Qualmann wrote:
>
> I think you should first check their hard drive. It is well
> possible that it has defective sectors. It would be a possible
> explanation for the broken digiKam DB. Maik On Donnerstag, 17.
> November 2016 21:20:30 CET Mick Sulley wrote:
>
> I seem to have some corruption of my database (sqlite),
> some pictures do not display in Digikam. I just renamed my
> database and restarted Digikam (4.14) and it recreated the
> database, but the old file was 72.7 MB and the new one is
> 14.4 MB. The missing pictures do now display. I have
> checked through some of the tables and there are big
> differences in numbers, e.g. ImageMetadata 46,949 records
> in the old table, 21,310 in the new table. I feel that to
> be safe and not loose data I need to restore the old
> database. Any comments, advise? I have loads of tags and I
> really don't want to loose them and see no easy way to
> confirm that they are all there. Thanks Mick
>
>
>
> --
> Sent without keyboard or normal screen, hence lacking spelling,
> grammar and layout in greater doses than usually
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/digikam-users/attachments/20161123/271667a6/attachment.html>
More information about the Digikam-users
mailing list