Monitor informix database change
I'd like to generate test data for a web application we're developing. One approach I am thinking about is that if there is a way to monitor the database (we're using informix) when I add something via our web application and do a batch of operations, so that I can see what data are inserted 开发者_高级运维during the operation time and thus can export these data as test data.
Any idea ?
Thanks.
There are various options, with varying degrees of plausibility. One issue you'll have to worry about is deletes vs updates vs inserts; tracking inserts is easy, deletes hard.
- CDC - Change Data Capture: this API allows you to track the changed data.
- ER - Enterprise Replication: you could set up a second server which tracks the changes made in the first.
- Log mining - extracting data from backups of the logical logs.
- Trigger-based change tracking - creating triggers on tables of interest to track changes.
- Audit-based change tracking - doesn't include the data that was changed, so probably least relevant.
Of these, CDC is probably the most comprehensive and best, but it has overhead to get it working (setup process - not runtime overhead; the latter is not significant).
The trigger-based tracking requires least intervention from programmers and system administrators; it is fiddly (rather than truly difficult) to set up. Once you have a template for the first table, the other tables follow systematically; you just need to script something to create the correct triggers for each table you need to track.
精彩评论