• 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.
  • The November 2019 Lightroom updates are now available. Lightroom Classic includes the ability to export the same photos as multiple sizes/formats in a single export, content aware fill for panorama edges and more. It does require a catalog format upgrade and there are updated system requirements, so you may want to wait a few days before upgrading.
    Lightroom (cloud-based service) has export options (such as TIFF format, renaming and color space), custom sort order on the desktop, copy/paste to multiple photos on iOS and more.
    The Missing FAQ and Edit Like a Pro eBooks are already updated for the changes.
  • Stop struggling with Lightroom! There's no need to spend hours hunting for the answers to your Lightroom 6 questions. All the information you need is in Adobe Lightroom 6 - The Missing FAQ!

    To help you get started, there's a series of easy tutorials to guide you through a simple workflow. As you grow in confidence, the book switches to a conversational FAQ format, so you can quickly find answers to advanced questions. When you upgrade to subscription, there's also a Lightroom Classic version available.

Repair of corrupted catalogs

Joined
Sep 29, 2007
Messages
21,800
Location
Southampton, UK
Lightroom Experience
Power User
Lightroom Version
Cloud Service
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.
 

Aimevous

New Member
Joined
Jul 2, 2018
Messages
3
Lightroom Experience
Power User
Lightroom Version
No worries, any help will be greatly appreciated! thanks!
 
Joined
Sep 29, 2007
Messages
21,800
Location
Southampton, UK
Lightroom Experience
Power User
Lightroom Version
Cloud Service

Nunki

New Member
Joined
Jul 21, 2018
Messages
1
Lightroom Experience
Advanced
Lightroom Version
5.x
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!
 

Kumagera

New Member
Joined
Sep 19, 2018
Messages
1
Lightroom Experience
Intermediate
Lightroom Version
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!
 

Stubac

New Member
Joined
Dec 28, 2018
Messages
1
Lightroom Experience
Intermediate
Lightroom Version
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 -
. 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!!
 
Joined
Oct 8, 2007
Messages
5,092
Location
London
Lightroom Experience
Power User
One word you forgot to mention is "Backup" ;) .

And let's remember that catalogue corruption is actually rare.
 

Roelof Moorlag

Senior Member
Joined
Jan 27, 2013
Messages
1,128
Location
Netherlands
Lightroom Experience
Power User
Lightroom Version
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!
 

johannrousselot

New Member
Joined
Apr 18, 2019
Messages
2
Location
Delhi, India
Lightroom Experience
Intermediate
Lightroom Version
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).
 
Joined
Sep 29, 2007
Messages
21,800
Location
Southampton, UK
Lightroom Experience
Power User
Lightroom Version
Cloud Service
Hi Johann, yeah, we'll give it a shot.
 

kwatkins26

New Member
Joined
Apr 18, 2019
Messages
2
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.
 
Joined
Sep 29, 2007
Messages
21,800
Location
Southampton, UK
Lightroom Experience
Power User
Lightroom Version
Cloud Service

PhilBurton

Lightroom enthusiast (but still learning)
Premium Classic Member
Premium Cloud Member
Joined
Nov 16, 2015
Messages
1,843
Location
California, USA
Lightroom Experience
Intermediate
Lightroom Version
Classic
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
 
Joined
Sep 29, 2007
Messages
21,800
Location
Southampton, UK
Lightroom Experience
Power User
Lightroom Version
Cloud Service
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
 

PhilBurton

Lightroom enthusiast (but still learning)
Premium Classic Member
Premium Cloud Member
Joined
Nov 16, 2015
Messages
1,843
Location
California, USA
Lightroom Experience
Intermediate
Lightroom Version
Classic
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
 

Pidgeoncoop

New Member
Joined
Jul 20, 2013
Messages
4
Lightroom Experience
Intermediate
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
 
Joined
Sep 29, 2007
Messages
21,800
Location
Southampton, UK
Lightroom Experience
Power User
Lightroom Version
Cloud Service
Got it Peter, I'll let you know what they say.
 
Top