Copying Database While Open

Is it acceptable for me to copy a database file for backup purposes while it is open?

I presume this works since that is what Time Machine does.

But can the database get corrupted if changes are made to it while it is being copied?

Also what timing or event causes DT3 to save edits to disk so the Date Modified field gets updated? Selecting “Optimize Database” seems to force an update of the database on the drive - is that correct?

Ideally I would close the file before copying it but I am trying to set up an automated backup system for when I am not by the computer. Plus I often have staff using the database via web and would prefer not to have to kick everyone off the web server in order to do a scheduled backup.

This doesn’t have any impact on the database but the copy might be damaged if DEVONthink updates the files while copying. But if it’s a versioned backup like Time Machine this shouldn’t matter, it’s unlikely that all available backups are corrupted like that.

Changes are written back to disk after a small delay, usually less than a second.

Time Machine uses a snapshot-style backup, so it’s safe to have it running while the database is open. Indeed, since Time Machine does hourly backups by default, this is already happening.

But if you’re scheduling with another application, you could potentially set the backup for a time when no one is using DEVONthink, say 11:00pm, so the database is either inactive or you’ve quit DEVONthink for the day.

I do that - but I would also like to cover the situation of what happens if there is some sort of failure during the day. Ideally I would prefer to not lose all the work done the entire day.

The software I plan to use for backup does do versioning (it is Chronosync https://www.econtechnologies.com/chronosync/overview.html ). If I set that to run say every 6 hours and the database changes during one of the backups, does that mean only the particular file(s) edited are likely to be affected but it is not going to corrupt the whole backup by creating the backup while the database is in use?

And yes, I also use Time Machine so Chronosync will only be a Plan B solution. But my concern is that my Time Machine backup could be silently corrupted so I would prefer to also have a solution that backs up everything from scratch periodically.

I can’t speak for the efficacy of Chronosync in this situation as I don’t use it. @korm did (and may still) use it, so perhaps he can comment on it.

I do not use ChronoSync for this purpose any longer. I rely on Backblaze to back up my documents (including database packages) on a continual basis. A note on how Backblaze handles packages (e.g., .dtBase2 packages) can be found here.

“Losing an entire days work” probably means losing edits to the documents I worked on that day. I do not need to restore an entire database from Backblaze in this case, just the relevant files for that day. It’s cumbersome to find and search for these things – and thankfully is a vanishingly rare occurrence – but it works.

1 Like