Your mileage may vary, but this process just saved my hide. I’m writing this as a quick reminder in case I ever need to do this again. Running OSX Yosemite on a Mac Pro, using OSX’s default/included sqlite3 binary (SQLite version 3.8.5).
Fire up Terminal
Navigate to the directory that contains your Lightroom Catalog, example (mine is on an external hard drive)
Use sqlite3 to dump your Lightroom Catalog as an .sql file:
echo .dump | sqlite3 Master_Catalog.lrcat > master_catalog.sql
Then re-generate your .lrcat using sqlite3 and the sql dump you just created:
sqlite3 master_catalog_restored.lrcat < master_catalog.sql
Open your restored catalog in Lightroom. Wipe nervous sweat from brow. Smile.
I’d been keeping my catalog in a Dropbox folder for the sole reason of having it automatically versioned and backed up by the good folks at Dropbox. It had worked well for the better part of 6 months but something got out of whack. During the last few days I could only get my catalog to open once and then it would randomly crash and complain of trouble “reading the catalog file”.
I tried repairing it using the built in “repair catalog” pop-up in Lightroom. No dice. I also tried creating a new catalog and “Importing from another Catalog” (importing from the one that was giving me issues). That didn’t work either. I could restore one good version from Dropbox and get it to open, but if I tried to back up that version or do anything else, it would immediately crash. After a google search I found this post by Gordon Haff (which was a hair outdated) but got me going in the right direction. Thanks Gordon!
This method of dumping and restoring worked to fix whatever the hell was wrong. I don’t know why or how. Fuck keeping my main catalog in a dropbox folder though, it’s too important. I’m back to keeping it on the same external drive as my archive, backing up once a week via lightroom to the same catalog location and then automatically copying that to a secondary backup drive every other day.
Two types of people. Those who have backups, and those that will. 🙂