How to recover from a corrupt Lightroom Catalog

… once and for all.

If you are a photographer that uses Lightroom you might have encountered a catalog problem. Sometimes they just clear up by themselves, but it may occur that you lose some of your precious work along the way.

Lightroom Catalog is corrupt
Lightroom Catalog is corrupt

The first thing you should try upon encounter of a message like this one above, is to delete the .lock file. Together with the catalog (.lrcat) you should find .lrcat-journal, .lrdata and .lock files. Well, delete or change the extension of the latter.

Screen Shot 2015-08-04 at 13.39.49

If this does not resolve the problem, and instead you’re more f**** than before, then this is what happened to me and you’re on the right post.


Let’s play the magic

As it turns out, Lightroom catalogs are simply sql tables underneath. So by extracting it into a .sql file and recreating a new catalog from it will, in fact, solve all our problems with no data loss. To do this, use the command line tool sqlite3.

** If you don’t have this command, probably you need to download the command line utilities that fit your operating system from SQLite’s home page (http://www.sqlite.org).

  1. Open a terminal window
  2. Dump the .sql info:
    $ echo .dump | ./sqlite3 ~/catalog.lrcat > ~/catalog.sql
  3. Recreate a new catalog from it:
    $ ./sqlite3 -init ~/catalog.sql ~/new_catalog.lrcat

NOTE: Try sqlite3 (without ./) if your sql utility was already installed in your system root.
NOTE 2: Also, ~/ stands for your home path. Replace it with the path to the catalog as seen from the folder you’re in at the moment.

So simple, yet so powerful. I don’t understand why Lightroom’s automatic repair system won’t try doing this!

Author: Bea Cabrera

Freelance Filmmaker with a passion for big cities, snowboard, cinema and a weakness for the smell of freshly ground coffee. Engineer & Graphic Designer in a previous life, loving and living both: art and technology.  

8 Replies to “How to recover from a corrupt Lightroom Catalog”

  1. Alejandro Peralta says: July 4, 2016 at 1:08 pm

    And yet I couldn’t recover my catalog. It truncates it at just over 5GB while the original is about 5.5Gb. I am loosing something there. Thanks anyway this goes a bit further than LR trying to repair it by itself

  2. Mark P. says: October 12, 2016 at 8:47 pm

    Works as advertised, but you do need to be fairly confident with a command-line. Thanks for posting this; it’s been a huge help.

  3. Keith Johnson says: September 25, 2017 at 7:21 pm

    Just wanted to say thank you. This helped recover a lot of keywording information from a catalog that corrupted when a disk crashed. I REALLY appreciate your passing this insight along!

  4. Kevin says: November 8, 2017 at 4:24 pm

    I have different LR catalogs on my external drive, but only one of them is corrupted. Using your method, how do I know that I am recreating the proper catalog? I apologize if I sound dumb… but that’s because I kinda am with this sort of thing. Thanks

  5. Steven Taylor says: December 28, 2018 at 8:24 am

    If the above doesn’t work, not all is lost. It didn’t work for me, and I tried the following, hoping it would work.
    Enter into the sqlite3 program command mode, type the following and hit the enter key:

    .open YourCorruptedLRCatalog.lrcat

    Then type the following and hit the enter key:

    .clone NewCatalog.lrcat

    To exit the command prompt (exit out of the sqlite3 application) type the following and hit enter:


    I’m not certain what precisely happens, but my corrupted file was 1.4 GB in size and the newly created file, a clone came back as 980 MB in size. The cloning process must ignore so-called deleted data or whatever.

    Anyway, copy the newly created catalog file back to your LR folder, rename it to the original file.

    The above worked for me.

    1. Karin Ravenna says: January 4, 2019 at 7:08 am

      It worked! thank you!

    2. Negm says: March 10, 2019 at 9:47 pm

      This works indeed, thanks !

  6. Matthew Antos-Lewis says: March 6, 2019 at 12:44 pm

    Thanks, this led me on the right path (though as Mark P. commented above, you do need a degree of familiarity with command prompts), and I eventually managed to resolve the issue.

    A complete novice’s walk-through for Mac:

    (Nb. In MacOS, in order to properly open a command window you will need to go into system preferences/Keyboard/Shortcuts/Services and click on “New Terminal at Folder”. Now right click on the folder containing the sqlite files and your catalogue and select services/new terminal at folder.) tempcatalog.sql ;
    This will create an SQL file in the SQLite3 folder.

    4. Next, in the terminal window type the following, and press return:

    sqlite3 -init tempcatalog.sql newcatalog.lrcat ;

    This will create a new .lrcat catalog file in the SQLite3 folder.

    5. Replace the corrupted .lrcat catalog file in the original folder with the ‘newcatalog.lrcat’ version. Rename the new file so it has the correct filename, i.e. the same as the old corrupted one.

    If the ‘newcatlog.lrcat’ file is 0kb, fix it by opening the tempcatalog SQL file with text edit, fine and replace ROLLBACK DUE TO ERRORS with COMMIT TRANSACTION, save it, then try building the LRCAT file from the SQL file again using the second command (step 4 above).

Leave a Reply

Your email address will not be published.

You may use these <abbr title="HyperText Markup Language">html</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


This site uses Akismet to reduce spam. Learn how your comment data is processed.