如何对 SQLite 进行增量备份?
我有一个程序可以将日志数据保存到 SQLite3 数据库中。我想在程序仍在运行时备份数据库。我通过使用 SQLite Online Backup API (http://www.sqlite.org/backup.html )并且它工作正常,但是它会滞后于备份完成的过程...
有谁知道在 SQLite 中进行增量备份的方法吗?我最好在每次运行备份时只备份新数据,而不是整个数据库。
I have a program that saves logging data to an SQLite3 database. I would like to back up the database while the program is still running. I have accomplished this by using the SQLite Online Backup API (http://www.sqlite.org/backup.html) and it works fine, however it lags the process until the backup is complete...
Does anyone know of a way to do incremental backups in SQLite? I would preferably only backup new data, not the entire database each time I run the backup.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为没有通用的解决方案可以解决您的问题。
如果您的日志数据带有时间戳并且结构相当简单,
您可以运行一个单独的进程来提取最近的数据并将其插入
进入您的备份流。
I don't think there is a general purpose solution to your problem.
If your logging data is timestamped and reasonably simple in structure,
you could run a separate process to extract recent data and insert it
into your backup stream.
我创建了一个名为 sqlite3-incremental-backup 的库(在 NodeJS 和 Python 中)为此,如果您想看看。
I made a library named sqlite3-incremental-backup (in NodeJS and Python) for this purpose if you want to have a look.