• Welcome to the Lightroom Queen Forums! We're a friendly bunch, so please feel free to register and join in the conversation. If you're not familiar with forums, you'll find step by step instructions on how to post your first thread under Help at the bottom of the page. You're also welcome to download our free Lightroom Quick Start eBooks and explore our other FAQ resources.
  • Dark mode now has a single preference for the whole site! It's a simple toggle switch in the bottom right-hand corner of any page. As it uses a cookie to store your preference, you may need to dismiss the cookie banner before you can see it. Any problems, please let us know!

Repair of corrupted catalogs

Status
Not open for further replies.

Tomiron

New Member
Joined
May 28, 2012
Messages
3
Location
Sweden
Lightroom Experience
Advanced
Trying to open a corrupt catalog of mine makes LR freeze forcing me to kill the actual LR-process to proceed. I also need to delete the preference files to start LR again. It is not possible to import any data from the corrupted catalog to a new one. (My latest backup catalog works just fine though, but lacks quite a few hours of work...)

Is there by any chance a way to check integrity or do any other kind of catalogue repair of corrupted catalogs that doesn't open in LR? If I'd been more of a tech-pro I'd might been successful in using sqlite3 or sqlite analyzer to check the database. Now is that not the case..

I'm aware of that holding down the Alt-key (on Win) or Opt-key (on Mac) while simultaneously clicking on the LR icon in the dock cause LR to open but not to open the default catalog. Instead it shows a dialog with a list of available catalogs and an option to create check integrity of each catalog. In my case - this doesn't work. If I choose my corrupted catalog following this procedure this will still cause LR to crash.

Working in LR 4, Win7 64 bit, 4GB RAM, accessing catalog and previews from an external drive, images stored on a multiHD-NAS.
 
I have a Catalog that got corrupted after I did a force shutdown on my computer and I haven't been able to repair the file.
Do you think you can assist me?
I've downloaded and forward it. Adobe US are shut down this week for annual vacation, so there may be a delay in getting it back to you.
 
Hi Victoria,

I foolishly used my LR5 catalog on a friend's computer that had LR CC installed. The catalog got upgraded and now I can't downgrade it back to be used in LR5.
I've tried the SQLite approach, but it;s still not recognising it.

Any ideas?

Thanks!
 
HURRAY!!!
It was a space in front of the "echo" command :rolleyes:
After converting the lrcat into sql , I tried to convert it back to lrcat, but after two errors
Error: near line 7895330: PRIMARY KEY must be unique
Error: near line 7895580: PRIMARY KEY must be unique
it saved a zero bytes lrcat file.

So what I did was, I opened the sql file in notepad and modified the last line from
ROLLBACK; — due to errors
with the line:
COMMIT TRANSACTION;
And THEN do the
C:\SQLite>sqlite3 -init tempdbase.sql dbaseRecovered.lrcat
and... SUCCESS!!! :cool:


AWESOME! this was the info I needed to finally recover my corrupt catalog... (after days of trying)

This!

ROLLBACK; — due to errors
with the line:
COMMIT TRANSACTION;
And THEN do the
C:\SQLite>sqlite3 -init tempdbase.sql dbaseRecovered.lrcat


Thank you very much djeebah, YOU ROCK!
 
I had a corrupt catalog. Devastating to think what I could have lost, and has taken hours of research and trial and error but I have got my catalog back and as far as I can tell, I have not lost anything.

Thanks very much to this forum for getting me started. I found lots of great ideas through the 6 or so years this catalog corruption has been happening to people. After the start I got here, I wanted to help people find resources they might find useful. Some I found through this forum, some by my own searches.

Notes: Remember that once you are in trouble, stop and think before you do anything. As soon as my catalog became corrupt, I decided to backup in my usual way, and immediately overwrote what might have been a working recent version of my catalog with the newly corrupt one. Bother - or words like that!!

Before you start working to try to repair your catalog, take copies (maybe a few copies) of your catalog and work with the copies - not with your originals which you still have and which you may be able to repair fairly easily. Try the simplest fix options first. Look at this blog - "Disaster strikes – a corrupted catalog!" - Disaster strikes - a corrupted catalog! | The Lightroom Queen. It is a good place to start, and will get you thinking in appropriate ways. From this page, I learnt where to find my backups, and starting to use a recent backup (three shoots-1000 edited pictures - missing in my case) was a great start. At least you can feel that you are working again and Lightroom will start with a LOT of your work. I felt better, but was still missing work.

Look at some of these pages so you can find alternate solutions, and understand what you are trying to do:

How I repaired my corrupt CATALOGUE
How I Repaired My Corrupt Lightroom Catalog

Recovering corrupt Lightroom Catalogs
Connections: Recovering corrupt Lightroom catalogs
Important idea - look for ROLLBACK; at the end of your SQL file.

Recover from a corrupt Adobe Lightroom catalog file
Recover from a corrupt Adobe Lightroom catalog file

I tried several of the things mentioned above, but my catalog was still corrupt. In the end, the way I fixed my corrupt catalog was:
Note - These notes are based on working in windows. These notes do not go into how to work in the command shell. These instructions assume a fairly good level of computer knowledge and understanding.
For Reference, this happened in December 2018 with version Lightroom Classic version: 8.0 [ 1193777 ] License: Creative Cloud. The size of the catalog was just over 1 GB

1. I downloaded and installed the command line version of SQLite3 - DB Browser for SQLite Check install instructions, because it is vaguely complicated. This youtube page helped me to install it properly - https://www.youtube.com/watch?v=zOJWL3oXDO8. There were plenty of other options for this step.

2. I also downloaded DB Browser for SQLite from DB Browser for SQLite . This means you do not have to use the command line interface, and makes export of the catalog easier. I believe that you need both tools to work together.

3. I saved the corrupt lrcat file to a .SQL file by doing the following things:
a) In the DB browser, I Clicked on File > Open Database (CHANGE the file type it is searching for to All files (*) and then selected the copy of the corrupt catalog I was going to use for this process)
b) The DB Browser shows you a list of the things it has found in the database.
c) Click on File > Export > Database to SQL file ...
d) Click the Select All button. Just leave the defaults. Click on OK
e) Choose the location where you want the file saved, and its new name. Click on OK.
f) If you want to do that on the command line, use a command like:
echo .dump | sqlite3 "my Corrupt Catalog.lrcat" > lightroomCatalogue.sql
echo .dump | sqlite3 [Name of corrupt catalog. Use Quote marks if there are spaces in the name] > [Name of the new SQL file]

4. I opened the SQL file with Notepad++ which is a text editor - DO NOT USE MICROSOFT WORD - and looked for the problem that the last line of the file contained the word ROLLBACK; It did, so I changed those words to COMMIT TRANSACTION; (see Connections: Recovering corrupt Lightroom catalogs for more details) and saved the changed file using a new name so that I had a backup copy.

5. I imported that SQL file to a new file which was to become my new catalog. This step created a new file for me, but Lightroom did not recognise it as a catalog. I would still try this step first, as it seems for most people it will work.
a) I tried DB Browser, but it kept crashing. Might just be my computer. If you want to try this, start by clicking on File > Import > Database from SQL file... I know that if you have a database (catalog) open, the import will want to write changes into that file. If you do not have a database open, it will allow you to create a new file.
b) I went back to the command prompt. I used the command:
sqlite3 lightroom_catalog_restore.lrcat -init New_lightroom_catalog.sql
sqlite3 [Name of new catalog. Use Quote marks if there are spaces in the name] -init [Name of the the SQL file]

I tested the lightroom_catalog_restore.lrcat file in Lightroom. It did not work for me, but it might for you.

The command that worked for me was to overwrite the corrupted catalogue (use a copy!!) with the data from the SQL file.
sqlite3 "my Corrupt Catalog.lrcat" -init New_lightroom_catalog.sql

When I tested the result of this, it worked in Lightroom but for whatever reason, I felt like that file was unstable. What I did in the end was to use the last known good catalog, and from Lightroom, clicked on File > Import from another catalog...

This has now been working successfully for 4 days. I have imported and worked on 2 additional shoots without error.

Good luck!!
 
One word you forgot to mention is "Backup" ;) .

And let's remember that catalogue corruption is actually rare.
 
After the start I got here, I wanted to help people find resources they might find useful. Some I found through this forum, some by my own searches.
Thanks for sharing this information and welcome to this forum Stubac!
 
Hello Victoria,
It's really nice to run such a comprehensive forum and try to help those LR users, who one day or another will face a major issue. So, if I'm here now it's because it's my case of course. As all others before me in this topic, I have a corrupted catalog and no backup worth being used. And I've tried those sqlite things and all, but I'm not good at this. Couldn't fix anything. I read that many people send you their catalog and you see if it's repairable or not. Could you do this for me ? This catalog contains several years of photography... (I can't attach this catalog here, it doesn't let me choose it).
 
Hi Johann, yeah, we'll give it a shot.
wetransfer.png
 
Hello Victoria! I've been sent here by the great Holger! He tried to fix my catalog, to no avail. I'd be so appreciative if you took a shot at it. I've tried everything. I can't believe this is even an issue.
 
Got them both.
 
Hi Johann, yeah, we'll give it a shot.
wetransfer.png
And what a nice shot !! Thanks a 1000 times Victoria for helping so generously. You have sent me back, thanks also to Rikk/Adobe, a repaired catalog that has saved me days and days of work ! Thank you so much !!
 
And what a nice shot !! Thanks a 1000 times Victoria for helping so generously. You have sent me back, thanks also to Rikk/Adobe, a repaired catalog that has saved me days and days of work ! Thank you so much !!
Victoria,

Is there anyone who is a member of this forum who has the skills to compare the corrupted catalog file with the repaired catalog file and draw conclusions? Conclusions that might lead to a blog post on self-repair of a corrupted catalog?

Phil Burton
 
Victoria,

Is there anyone who is a member of this forum who has the skills to compare the corrupted catalog file with the repaired catalog file and draw conclusions? Conclusions that might lead to a blog post on self-repair of a corrupted catalog?

Phil Burton

I'm not about to start recommending self repair until Adobe provides the tools to do so. Passing corrupted catalogs to Adobe helps them spot any patterns and then prevent/automatically fix those issues (although most I see are a result of hardware issues).


Sent from my iPhone using Tapatalk
 
I'm not about to start recommending self repair until Adobe provides the tools to do so. Passing corrupted catalogs to Adobe helps them spot any patterns and then prevent/automatically fix those issues (although most I see are a result of hardware issues).


Sent from my iPhone using Tapatalk
Victoria,
've underlined part of your message, because that is actually very encouraging. Hardware issues can cause data corruption in general. Your statement says to me that Lightroom per se isn't the source of most catalog corruption.

phil
 
Hi Victoria,

I run my local historical society's digital catalog on Lightroom CC Classic. It looks like I have disconnected the hard drive from the Mac before it was fully shut down and have corrupted the catalogue. We have a new collection of some 400 scanned images and metadata I have just spent 80 hours on. The photos are probably all OK and most of the metadata but if I use my backup (10 days old) I will lose all the metadata that I inputted directly a few days ago when I returned the negatives to the donor. I have googled solutions and run the SQLite fix suggested by Holger Mischke but it fell over at the end with "Error: near line 871889: no such table sqlite_stat4" and this repeats all the way through until line 872184.

I see you have had some success in having other catalogs repaired by an Adobe contact. Could I please ask if you could see if mine is repairable too. Otherwise I suspect it will be another two weeks potential work to get back to where I was.

I have zipped the file and transferred it to you via wetransfer to [email protected] (LightroomSPACECatalog-2)

Many thanks

Peter
Melbourne Australia
 
Got it Peter, I'll let you know what they say.
 
No joy, sorry Peter
 
Status
Not open for further replies.
Back
Top