# How to Check if Catalog is Corrupt?



## stevevp (Feb 4, 2020)

Firstly apologies, I only seem to find time these days to visit this forum when I've got a problem! :(

Yesterday Lightroom crashed (or my computer otherwise locked up) when I was closing Lightroom and doing a back up. After waiting an hour or so I eventually had to kill the process and restart the computer.
When I opened Lightroom today all seemed well: it opened where I left it yesterday and I had not lost any edits. For some reason I went to check my preferences and it again locked up. I again had to kill the process and restart the computer. Lightroom again opened ok. 
Prior to this Lightroom had been completely stable. I'm not sure when I updated to 9.1 but I guess it was last December immediately it became available and it has been fine until now.

Before I do any more work in Lightroom, is there any way to check if the catalog is corrupt? Should I be reinstalling Lightroom and reverting to the previous catalog back up ? Or do I just carry on and wait until it crashes again?

Thanks for your advice.


----------



## Johan Elzenga (Feb 4, 2020)

If you quit Lightroom and let it make a backup on quit, it will verify the catalog before making that backup and optimize the catalog after the backup has been made.


----------



## stevevp (Feb 4, 2020)

Thanks John. It has completed the backup ok so can I assume that all is well with the catalog?
If LR crashes again, can I assume that it is the app and I need to reinstall?

Many thanks.


----------



## johnbeardy (Feb 4, 2020)

stevevp said:


> or some reason I went to check my preferences and it again locked up.



Try removing your preference file and restarting LR.

Also don't put too much emphasis on  catalogue corruption. It's rare, and more likely would be a problem with the preferences (more so on Mac) or with the graphics driver which should be up to date.


----------



## PhilBurton (Feb 4, 2020)

stevevp said:


> Firstly apologies, I only seem to find time these days to visit this forum when I've got a problem! :(
> 
> Yesterday Lightroom crashed (or my computer otherwise locked up) when I was closing Lightroom and doing a back up. After waiting an hour or so I eventually had to kill the process and restart the computer.
> When I opened Lightroom today all seemed well: it opened where I left it yesterday and I had not lost any edits. For some reason I went to check my preferences and it again locked up. I again had to kill the process and restart the computer. Lightroom again opened ok.
> ...


Steve,

I don't think you need to reinstall Lightroom, unless you suspect that one of its program files got corrupted.  You might need to revert to a backup of your catalog.


----------



## stevevp (Feb 4, 2020)

Thanks all for your advice.
Firstly, I deleted my preference file. I then used Lightroom all afternoon. I have just quit and backed up. The back up briefly hung with a Not Responding message and then continued albeit slowly until the program closed. I've  opened Lightroom again without a problem but it does seem that something's not right.


----------



## Victoria Bampton (Feb 5, 2020)

Where's the catalog stored Steve? There's just a red flag in my head that's wondering whether the drive might be on its way out.


----------



## stevevp (Feb 5, 2020)

Hi Victoria,
Many thanks for your reply. Eeek - I hope you're wrong!
I am using a new-ish custom made windows PC which was built in November 2018. It has two drives:

1) a 500GB Samsung 970 EVO M.2 PCIe Solid State Drive which has the operating system and programs; and,
2) a 4TB Seagate BarraCuda Pro 7200RPM Hard Disk for all the data *including the Lightroom catalog*.

Can I just move the catalog to the SSD and double click on it to open it  in Lightroom from the new location? Are there any other files I should move to the SSD?

Regards, Steve


----------



## LouieSherwin (Feb 5, 2020)

Also this is the time to make sure your backup are happening and are working. You might want to do a couple of test restores just to validate them.  I had main drive a SSD start to go flaky on me so I fired off a backup. Five minutes after the backup finished the drive dissappeared from my system and I could never get it be recognized again.  But I mounted my backup system disk kicked off a TimeMachine restore and had my system back up and running in under an hour. 

It is also a good idea to keep a reasonably up to date bootable clone around. It makes system recovery and other diagnostics much easier to accomplish.  I tend to update my bootable clone once a week and always just before installing any kind of system security or patch release. 

-louie


----------



## Victoria Bampton (Feb 5, 2020)

It may not be that, it could be something silly like a driver conflict. I'd just make sure backups are up to date, just in case. And yes, you can just move the catalog and double click if you want to try it on the SSD.


----------



## stevevp (Feb 6, 2020)

Thanks again for all the advice. Lightroom seems to have settled down and is not freezing on close down. I have therefore left things as they are and not moved the catalog. I have made some additional backups to other drives. Everything is already backed up using Crashplan to an external RAID drive and to their servers.  Hopefully that's enough.
Sometime I do need to create a bootable clone for the event I lose everything. That will have to wait for now. I am just about to go to Sri Lanka for a month - I am still working my way through the 3,300-odd photos I took there last year!


----------



## clee01l (Feb 6, 2020)

stevevp said:


> Thanks again for all the advice. Lightroom seems to have settled down and is not freezing on close down. I have therefore left things as they are and not moved the catalog. I have made some additional backups to other drives. Everything is already backed up using Crashplan to an external RAID drive and to their servers.  Hopefully that's enough.
> Sometime I do need to create a bootable clone for the event I lose everything. That will have to wait for now. I am just about to go to Sri Lanka for a month - I am still working my way through the 3,300-odd photos I took there last year!


When CrashPlan abandoned the end user market, I dropped it in favor of Acronis.  Acronis will make a bootable disk for recovery from a backup.


----------



## Samoreen (Feb 6, 2020)

stevevp said:


> Before I do any more work in Lightroom, is there any way to check if the catalog is corrupt?



Yes.  The Lightroom catalog is an SQLite database. So you can open it and check it with any SQLite Manager. I suggest using *SQLite Expert Personal 5.x* . It's free. You can download it from this page : SQLite administration | SQLite Expert . First, make a backup of your LR catalog. Once you have installed the software, launch it after closing Lightroom, select_ *File | Open Database*_, set the File Type to _*All Files*_ in the File Open dialog and select your .lrcat file (your Lightroom catalog).

Once you have loaded the catalog (database), use the _*Database | Check*_ menu. The software will tell whether your LR database is OK. After the check, just exit SQLite Expert.

You can also use this tool for a _*Database | Vacuum*_ operation in order to compact the file (which can also be done in LR with the _Optimize_ command).

The most adventurous users will also be able to manually change data in the LR catalog with this tool by using SQL requests. However, this requires having a good understanding of the LR database structure and of SQL. This is also a good way of analyzing LR bugs. I used it to analyze the very old, still not fixed bug described here : Lightroom Classic: Wrong timestamp stored in catalog causing wrong metadata status (all Windows versions) | Photoshop Family Customer Community .

Hope this helps.


----------



## PhilBurton (Feb 6, 2020)

Samoreen said:


> Yes.  The Lightroom catalog is an SQLite database. So you can open it and check it with any SQLite Manager. I suggest using *SQLite Expert Personal 5.x* . It's free. You can download it from this page : SQLite administration | SQLite Expert . First, make a backup of your LR catalog. Once you have installed the software, launch it after closing Lightroom, select_ *File | Open Database*_, set the File Type to _*All Files*_ in the File Open dialog and select your .lrcat file (your Lightroom catalog).
> 
> Once you have loaded the catalog (database), use the _*Database | Check*_ menu. The software will tell whether your LR database is OK. After the check, just exit SQLite Expert.
> 
> ...


Samoreen,

What do we do if SQLite reports database corruption?


----------



## clee01l (Feb 6, 2020)

PhilBurton said:


> Samoreen,
> 
> What do we do if SQLite reports database corruption?


Running the SQL commence "vacuum" should tell you if the catalog file is corrupt.   Once you have decided the catalog file is corrupt, then the standard remedies beginning with fall back to the most recent back up catalog.   At the extreme end of the process would be shipping the file off to Victoria to see if the Adobe magician can pull the rabbit out of the hat.


----------



## Samoreen (Feb 6, 2020)

PhilBurton said:


> What do we do if SQLite reports database corruption?



Like Philburton said : go back to your most recent backup (not the one you made before using SQLite Expert.


----------



## stevevp (Feb 7, 2020)

I've not rummaged around inside a database since SQL Server 7! When I get back from my travels I'll download SQLite Expert as you suggest. It will be interesting to have a look round inside the LRCat. Fortunately I do have multiple backups if I find anything wrong. Thanks again for the advice.


----------



## Samoreen (Feb 7, 2020)

Samoreen said:


> Like Philburton said



Sorry : like *clee01l *said


----------



## Samoreen (Feb 7, 2020)

stevevp said:


> It will be interesting to have a look round inside the LRCat.



Yes. The Lightroom database is not that easy to reverse engineer but with time, you can get a grip about how it works. Its structure is much more sophisticated than the more simplistic Capture One database (which is also an SQLite database). This can explain some behavior differences.


----------



## clee01l (Feb 7, 2020)

Samoreen said:


> Yes. The Lightroom database is not that easy to reverse engineer but with time, you can get a grip about how it works. Its structure is much more sophisticated than the more simplistic Capture One database (which is also an SQLite database). This can explain some behavior differences.


Now you tweak my curiosity! I'm familiar with the inside of the lrcat. I've never looked inside CaptureOne.


----------

