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