Java中Oracle表更改的通知 [英] Notification of Oracle table changes in Java
本文介绍了Java中Oracle表更改的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每次更新Oracle DB的特定表时,我都需要在Java中运行一个方法(任何类型的更新,包括记录添加,删除和修改)。
I need to run a method in Java every time a specific table of an Oracle DB is updated (any sorts of updates, including record additions, deletions and modifications).
最有效的方法是轮询一个表,以便从Java中获得具有良好性能的更改,并且不会对数据库施加太大压力?
不幸的是我有很多约束:
Unfortunately I have many constraints:
- 我无法创建额外的表,触发器,存储过程等,因为我无法控制数据库管理/设计。
- 我宁愿避免 Oracle更改通知,如中所提议的那样发布,因为它似乎涉及C / JNI。
- 仅计算记录不够好,因为我可能会错过修改和同时添加/删除ns。
- 实际更改和通知之间的延迟最多可达30/60秒。
- 我想要监控的表通常有100k +记录(约1m +)所以我不认为拉整个表是一个选项(从数据库加载/性能的角度来看)。
- I can't create additional tables, triggers, stored procedures etc., because I have no control over the DB administration / design.
- I'd rather avoid Oracle Change Notification, as proposed in that post, as it seems to involve C/JNI.
- Just counting the records is not good enough as I might miss modifications and simultaneous additions/deletions.
- a delay of up to 30/60s between the actual change and the notification is acceptable.
- The tables I want to monitor generally have 100k+ records (some 1m+) so I don't think pulling the whole tables is an option (from a DB load / performance perspective).
推荐答案
从oracle 11g开始,您可以将Oracle Change Notification与普通的JDBC驱动程序一起使用Link
Starting from oracle 11g you can use Oracle Change Notification with plain JDBC driver Link
这篇关于Java中Oracle表更改的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文