Corrupted catalog

Community Beginner ,
Jul 26, 2018

Copy link to clipboard

Copied

Hi, guys!

I have a problem with a LR catalog.

I am openening it, can see my last imported photos and then i have an error: LR encounted an error when reading a catalog file and need to quit. Then LR is shutting down and then trying to repair the catalog with no result.

Unfortunatly I have no backups. So how can i repair my catalog? It contains photoshoots for 2 years.

Thank you!

Adobe Community Professional
Correct answer by cmgap | Adobe Community Professional

I can't say whether this will work for you of if you are willing to give it a try... comments indicate that others have been successful repairing a corrupt catalog using this method.

How To Fix A Corrupted Lightroom catalog file using SQLite - YouTube

Views

4.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Corrupted catalog

Community Beginner ,
Jul 26, 2018

Copy link to clipboard

Copied

Hi, guys!

I have a problem with a LR catalog.

I am openening it, can see my last imported photos and then i have an error: LR encounted an error when reading a catalog file and need to quit. Then LR is shutting down and then trying to repair the catalog with no result.

Unfortunatly I have no backups. So how can i repair my catalog? It contains photoshoots for 2 years.

Thank you!

Adobe Community Professional
Correct answer by cmgap | Adobe Community Professional

I can't say whether this will work for you of if you are willing to give it a try... comments indicate that others have been successful repairing a corrupt catalog using this method.

How To Fix A Corrupted Lightroom catalog file using SQLite - YouTube

Views

4.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 26, 2018 0
LEGEND ,
Jul 26, 2018

Copy link to clipboard

Copied

The only advice I have seen is to open a new catalog and then try importing the corrupted catalog into it. I am quite skeptical that this ever works, but who knows. After that, I think you're out of luck.

Make regular and automated backups of your catalog file and photos from this point forward. No excuses.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Community Beginner ,
Jul 26, 2018

Copy link to clipboard

Copied

Thank you for the piece of advice, but how can i open an older catalog in a newer one?

Thank you!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
LEGEND ,
Jul 26, 2018

Copy link to clipboard

Copied

polinab  wrote

Thank you for the piece of advice, but how can i open an older catalog in a newer one?

Use the menu command File->Import from Another Catalog

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Community Beginner ,
Jul 26, 2018

Copy link to clipboard

Copied

unfortunatly, no

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Community Beginner ,
Jul 26, 2018

Copy link to clipboard

Copied

any other ideas?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Community Beginner ,
Jul 26, 2018

Copy link to clipboard

Copied

Here is the error:

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Community Beginner ,
Jul 26, 2018

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
LEGEND ,
Jul 26, 2018

Copy link to clipboard

Copied

As far a I know, this is the end of the trail. The catalog cannot be fixed.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Adobe Community Professional ,
Jul 26, 2018

Copy link to clipboard

Copied

I can't say whether this will work for you of if you are willing to give it a try... comments indicate that others have been successful repairing a corrupt catalog using this method.

How To Fix A Corrupted Lightroom catalog file using SQLite - YouTube

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Community Beginner ,
Jul 28, 2018

Copy link to clipboard

Copied

Thanks! I will try!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 28, 2018 0
Advocate ,
Jul 26, 2018

Copy link to clipboard

Copied

Do you have backups for your catalog?  If you don't know, search all your drives using the term "backup"

The backup folders that Lightroom creates look like this:

LR backup folders.PNG

If you find those, pick the most recent one and open the folder. The file inside will be a .lrcat.zip file you will have to unzip. The unzipped file will end with .lrcat. Open that unzipped file in LR.

Kenneth Seals

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 26, 2018 0
Community Beginner ,
Jul 28, 2018

Copy link to clipboard

Copied

Unfortunatly, I haven't

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 28, 2018 0
Community Beginner ,
Jul 28, 2018

Copy link to clipboard

Copied

I'have found the solution: Corrupt Catalog Issues

- Download SQLite, put it in a folder, make a COPY of your lrcat file and put it in the folder.

- run sqlite3 "INSERT_CATALOG_NAME_HERE.lrcat" .dump > Temp.sql

- run sqlite3 -init Temp.sql NEW_CATALOG_NAME.lrcat

- This is where the existing online tutorials break down, if there are errors, it will not dump out the new database file!  You can't just tell sqlite to dump a corrupt catalog to corrupt sql and back to a corrupt catalog...you're not fixing anything.

- Note the errors that the last command generates.  It will give you line numbers for the errors.  For me, I was getting "UNIQUE constraint failed" errors and "no such table" errors for the table sqlite_stat4 on a couple hundred lines or so.

- Open the Temp.sql file in an editor.  Notepad will work but it's way easier to deal with line numbers in something like Notepad++.

- Remove the exact lines which are generating errors and only those lines.  As you are working in the file, you may need to be patient with your editor if the file is large.  Jumping around, deleting lines, saving, may all take some time to complete...just wait for notepad++ to do its thing and unfreeze as you're working.

- If you try to use the file at this point, it won't work!  it will generate a 0 byte catalog (At first I had this problem).  The reason for this is that SQLite writes "ROLLBACK;" as the last line in the file due to the errors it encountered during the dump process.  See here: sqlite - Sqlite3 recreates empty database from dump file - Stack Overflow .  What you need to do is change that last line to say "COMMIT;" to commit the changes instead of rolling back.

- Now save the file...let's use TempBadLinesRemoved.sql and exit notepad++ or your preferred editor.

- run sqlite3 -init TempBadLinesRemoved.sql NEW_CATALOG_NAME.lrcat

- for me, the command completed and left me at the sqlite> prompt.  Just type .quit to exit sqlite

- Open the catalog in lightroom and it should work.

I am so happy! thank you very much! 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 28, 2018 5
Community Beginner ,
Dec 21, 2019

Copy link to clipboard

Copied

I'm trying to follow your steps but I noticed that the UNIQUE constant failed errors lines in my case are in the range of milions (i.e. Error: near line 1121903: UNIQUE constraint failed: Adobe_imageDevelopSettings.id_local) instead when I open the .sql file are in the range of thousands.
Any suggestions?

Thanks in advance!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 21, 2019 0
Community Beginner ,
Feb 15, 2020

Copy link to clipboard

Copied

Despite the errors you should be able to open the newly created catalog and it should run without problems. Can you confirm?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 15, 2020 0
New Here ,
Nov 13, 2020

Copy link to clipboard

Copied

Oh my God! Dude. This was a lifesaver for me. Recovered my catalog successfully after getting rid of few UNIQUE CONSTRAINT errors and putting COMMIT at the end. 

 

Using Lightroom Classic 10.0 (2020)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 13, 2020 0
w_otto LATEST
Community Beginner ,
Jan 12, 2021

Copy link to clipboard

Copied

Thank you very much for helping me saving 13000 of processed files!

It might be useful to know, that the files sqlite3.dll, sqlite3.def and sqlite3.exe together with the corrupted file are needed to be in the same directory.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 12, 2021 0