0

我们正在开发基于 SAAS 的应用程序。要求之一是记录数据库表中的每次更改,即创建基于日期/时间的数据版本。客户端应该能够恢复到任何版本的数据。

我在数据库中有近 30 个表,数据插入频率是每天通过批量导入添加/更新 80,000 条记录。但是,客户端也可以使用 GUI 通过表单插入数据(批量导入除外)。

在创建任何策略来实现此要求之前,我希望您能就如何实现这一点提出意见/建议。

附带说明一下,我查看了这篇博文,发现它是一个很好的起点,但我仍然怀疑如何恢复过去的数据。

数据库快照是一个很有前途的解决方案,但正如我之前所说,这是一个基于 SAAS 的应用程序,我们将多个客户端数据存储在一个数据库中,快照也会为其他客户端恢复数据。

请就如何执行此要求提出任何策略/计划。

4

1 回答 1

0

If you plan on using JPA/Hibernate to fetch your data, you can give Envers a shot.

Envers is a JBoss open-source project for maintaining versions of Database Entities. You can mark certain columns of the entire table with @Audited annotation to start tracking audit history. It typically stores all the audit data in a table with _AUDIT name. It also provides API to query historical data.

For details please go thru http://www.jboss.org/envers

于 2012-03-13T04:20:03.480 回答