DEVONthink Part 7 - Database Maintenance

Today I want to cover the distinctly un-sexy task of maintaining your DEVONthink Pro Office databases. It's one of those things that makes you initially want to yawn, yet as soon as you run into difficulties, you will be so glad you took the time to safeguard against disaster.

Internal Backups

By default, DEVONthink Pro Office creates regular backups of the databases index files. These are then used in the rare occurrence of the system being corrupted. These internal backups are kept directly inside the database folder. You can define how often these backups are taken by opening Preferences and clicking the Backup section.

These backups are NOT backups of the entire database. For these, you would need to use Time Machine or a similar third party application. I use BackBlaze for my off-site storage and Time Machine to back up the databases to my local NAS device, as well as exporting via a script (I come to that next).

External Backups

You can export all files contained within your DEVONthink Pro Office databases to external storage quite easily. Simply highlight all groups within your database with cmd+A, then go to File -> Export -> Files and Folders. You will then be prompted for a location to export your content to by way of a standard Finder window.

You can also use an AppleScript to backup all files and folders within a database and schedule it to run with Automator if you want to take it up a notch. The built-in Export script is great and you get it by clicking Scripts -> Export -> Daily Backup Archive.

This will compress all files and folders into a nice little zip file ready for you to transport anywhere you like. I have a Hazel rule that runs which checks for the presence of this .zip file in my Holding Folder and creates copies on my NAS and OneDrive for Business folders. Yes, this may be overkill, but I'm not going to lost my data and that helps me sleep.

Verifying and Repairing

Databases get damaged over time. It's going to happen. The most common inconsistencies I receive are when I index an external folder - sometimes I will receive errors, saying that files are missing. These errors can be repaired (not always, but most of the time) by going to Tools -> Verify and Repair. DEVONthink will then check the consistency of the database and warn you of any errors, as well as letting you know the action that has been taken where appropriate.

Rebuild Database

Sometimes, the errors that appear above can't be repaired via the Verify and Repair tool. One of the options you have is to go to Tools -> Rebuild Database. Here, DEVONthink will export all of your files and group and re-import them into a new database. It sounds like a lengthy task but I've never had a database rebuild take longer than a minute and, invariably, it solves any problem I had.

Restore Backup

You can, of course, restore manually form one of the backups defined earlier. Go to Tools -> Restore Backup and choose from one of the point-in-time backup slots available. (Please note - if you elect to Rebuild Database, a backup will be created automatically. That is why I have 4 restore options available in the screenshot below.

Thanks for reading. My next post will be the last in the DEVONthink series and will look at the different Preferences settings that can be applied.