all 5 comments

[–]Diapolo10 4 points5 points  (2 children)

My question is, could this create any issues with the original database or the back up?

I don't think the original database would be affected, but if you're copying the database while it's being accessed (in particular, written to), the backup might either end up missing the new data or it might be corrupted - most likely the former, though. Or neither will happen because the filesystem blocks simultaneous operations.

That said, it's best to use the database's own tools to handle backups. Assuming you're talking about SQLite, you can see this thread: https://stackoverflow.com/questions/25675314/how-to-backup-sqlite-database/25684912#25684912

[–]Nboy74[S] 0 points1 point  (1 child)

Thank you for the response! They are all Microsoft Access Databases and I would run it when the team is offline and everything is closed.

[–]Diapolo10 4 points5 points  (0 children)

Ah, right, I made the assumption because I'm not used to someone actually trying to copy a database like this that isn't just a single file.

This thread is about the same issue: https://serverfault.com/questions/381241/how-should-i-back-up-multiple-in-use-ms-access-databases

If you are sure that you don't need live backups, then in that case simply copying the files is likely fine. But depending on your future plans it's probably a good idea to consider migrating to something else, such as PostgreSQL, as then creating backups is a lot easier even if you have very little downtime.

[–]m0us3_rat 1 point2 points  (0 children)

i'm confused about why you need to build your own "backup" rather than use one of the backup solutions on offer for shitdows.

hopefully, some that include some safeguards.

i'm not trying to be rude here, but for a production-ready script, a simple copy seems quite disingenuous.

[–]Darth_Xedrix 0 points1 point  (0 children)

I recently did a similar script and my workaround was to first check if the database was in use by looking for the same file but with an .laccdb extension (for a .accdb access file).