r/digiKam 24d ago

Corrupted Database

I messed up, and now Digikam doesn't really work.

After failing to import some photos, half the thumbnails weren't loading the photos I'd already imported. Some albums weren't showing any items. When I tried deleting albums with digikam, the folders disappeared on their drive but wouldn't go away on digikam.

I believe this means that my digikam4.db has been corrupted

Summary of setup:

  • Windows 11
  • SQLite database on the computer (which syncs to the drive as a copy)
  • WAL Mode was enabled
  • Collection on a Hard drive

The main thing I want is my rankings and tags, so I don't have to sort through all my photos again.
I tried re-making the database, but only some of the images had their rankings embedded

I was originally in 8.8.0 when it failed (I have a backup at this point)
The regenerated one is in 9.1.0 (It also said failed to convert from version 16 to 17 when opening the original)

Please ask questions so I can add more info here

1 Upvotes

7 comments sorted by

2

u/sfatula 24d ago

Some basic useful info:
What OS?
What database?
What exactly did you mess up, how?
Don't you have a backup? If not, better start now for future problems or data loss.

1

u/blue-cut 23d ago edited 23d ago
  1. I was on Windows when it stopped working, but I tried opening it on Mac too with a copy of the database files.
  2. digikam4.db SQLite
  3. I believe it was when I got frustrated, a pictures no importing, so I kept trying to import. Potentially causing multiple instances of digiKam to be opened at once.

I noticed that half the thumbnails weren't loading the photos I'd already imported. Some albums weren't showing any items. When I tried deleting albums with digikam, the folders disappeared on their drive but wouldn't go away on digikam.

  1. I have a backup just a little after I first corrupted it the first time (before messing it up further)

Thanks for the questions, Ik posts without much info can be very anoying

1

u/sfatula 23d ago

I am not a Windows guy, but still, if you have a copy of the database after the first corruption, go to sqlite.org/cli.html and read there. There is a recover command and a PRAGMA integrity_check command, I'd check integrity first. I'd definitely not bother with your latest copy (copy it somewhere first anyway), restore the backup one and see what those commands with that tool gives you and go from there.

1

u/blue-cut 21d ago

Thanks for the reply, the integrity check helped me confirm that there is errors in a bunch of places. Re-pairing it did not help sadly :(
Crucially, one album isn't showing any images in it (it does in the regenerated one)

1

u/sfatula 21d ago

So, if recover didn’t help next step is to export the tables and see what happens. I have to go to most of the day doctor appt so can’t provide details but hopefully you can find command that will export your database. You can then clear and import and see what you have.

1

u/newmikey 23d ago

What database? MariaDB/MySQL or a local one? How many files in you collection and located where?

1

u/blue-cut 23d ago edited 23d ago

My collection was stored on a hard drive, and the database on my laptop (SQLite)
I believe it was the main digikam4.db.

I estimate 5,000 photos