简体   繁体   English

跟踪数据库上的更改

[英]Track changes on a database

I am not sure whether this has been asked before; 我不确定是否曾经问过这个问题; I did a few searches but nothing appropriate showed up. 我进行了几次搜索,但没有找到合适的显示。 OK, now my problem: 好的,现在我的问题是:

I want to migrate an old application to a different programming language. 我想将旧的应用程序迁移到其他编程语言。 The only requirement we have is to keep the database structure stable. 我们唯一的要求是保持数据库结构稳定。 So no changes in my database schema. 因此,我的数据库架构中没有任何更改。 For the rest of the application I am basically reimplementing everything from scratch without reusing old code. 对于应用程序的其余部分,我基本上是从头开始重新实现所有功能,而无需重用旧代码。

My Idea: in order to verify my new code was to let users do certain actions or workflows, capture the state of the database before that and after that and then maybe create unit tests with the help of this data. 我的想法:为了验证我的新代码是让用户执行某些操作或工作流,请在此之前和之后捕获数据库的状态,然后可以借助此数据创建单元测试。 Does anyone know an elegant solution to keep track of these changes? 有谁知道一个优雅的解决方案来跟踪这些变化? Copying the database (>10GB) is pretty expensive. 复制数据库(> 10GB)非常昂贵。 I also can't modify the code of the old application in which the users will be performing these sample actions. 我也无法修改用户将在其中执行这些示例操作的旧应用程序的代码。 I have to keep it on the database level. 我必须将其保留在数据库级别。

My database is Oracle 10g. 我的数据库是Oracle 10g。

You could capture the old application behavior with a trace and then validate the changes against your new code. 您可以通过跟踪捕获旧的应用程序行为,然后根据新代码验证更改。 But, honestly, trying to write a new application by capturing the data modifications it makes and the imitating that will be a very difficult task as the inputs and the outputs to the original application are not guaranteed to be stateless (that is, the old application might do the same thing the first 1,000,000 times it is given a certain set of inputs and do something completely different on the 1,000,001st run.) 但是,老实说,尝试捕获新数据对应用程序的修改和模仿来编写新应用程序是一件非常困难的事情,因为不能保证原始应用程序的输入和输出都是无状态的(也就是说,旧应用程序可能会在给定一组输入的前100万次中执行相同的操作,而在第1,000,001次运行中执行完全不同的操作。)

Your best bet is to start over with the business requirements and use the old application and a functional reference. 最好的选择是从业务需求开始,并使用旧的应用程序和功能参考。

Take a look at Oracle Flashback Queries . 看一下Oracle闪回查询

It enables to execute queries which return past data. 它可以执行返回过去数据的查询。 The timeframe is limited, but it can be very useful. 时间是有限的,但它可能非常有用。

In 10g the only way is to do with FLASHBACK queries.in 11g we can do this with RAT(Real Application Testing). 在10g中,唯一的方法是处理FLASHBACK查询。在11g中,我们可以使用RAT(真实应用程序测试)进行此操作。 RAT is quite useful for this senarios and also for load and volume testing. RAT对于此传感器以及负载和体积测试非常有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM