oracle中跟踪数据变化的最佳方法
正如我所说的标题,在oracle中跟踪数据变化的最佳方法是什么?我只想知道哪一行被更新/删除/插入?
一开始我想到了触发器,但是我需要在每个表上编写更多触发器,然后记录下影响我的更改表的rowid,这不好,然后我在Google中搜索,学习有关物化视图日志和更改的新概念数据捕获,
物化视图日志对我有好处,我可以将它与原始表进行比较,然后我可以获得不同的记录,甚至不同的字段,我认为方法与我从原始表创建/复制新表相同(但我不知道有什么不同?);
更改数据捕获组件对我来说很复杂:),所以我不想浪费时间来研究它。
有人有在oracle中跟踪数据变化的最佳方法的经验吗?
as the title i am talking about, what's the best way to track data changes in oracle? i just want to know which row being updated/deleted/inserted?
at first i think about the trigger, but i need to write more triggers on each table and then record down the rowid which effected into my change table, it's not good, then i search in Google, learn new concepts about materialized view log and change data capture,
materialized view log is good for me that i can compare it to original table then i can get the different records, even the different of the fields, i think the way is the same with i create/copy new table from original (but i don't know what's different?);
change data capture component is complicate for me :), so i don't want to waste my time to research it.
anybody has the experience the best way to track data changes in oracle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要查看 AUDIT 声明。它收集 SYS.AUD$ 表中的所有审计记录。
示例:
问候,
抢。
You'll want to have a look at the AUDIT statement. It gathers all auditing records in the SYS.AUD$ table.
Example:
Regards,
Rob.
您可能想看看金门。这使得捕获更改变得非常简单,但价格昂贵,但具有良好的性能和快速的设置。
如果性能不成问题,触发器和审核可能是有效的解决方案。
如果性能是一个问题并且 Golden Gate 被认为太昂贵,您还可以使用 Logminer 或 Change Data Capture。如果有这个选择,我会选择 CDC。
正如您所看到的,有很多选项,近实时和离线的。
手动编写解决方案也是有代价的,Golden Gate 值得研究。
You might want to take a look at Golden Gate. This makes capturing changes a snap, at a price but with good performance and quick setup.
If performance is no issue, triggers and audit could be a valid solution.
If performance is an issue and Golden Gate is considered too expensive, you could also use Logminer or Change Data Capture. Given this choice, my preference would go for CDC.
As you see, there are quite a few options, near realtime and offline.
Coding a solution by hand also has a price, Golden Gate is worth investigating.
Oracle 通过重做日志为您完成此操作,这取决于您尝试使用此信息执行的操作。我假设您的需求是复制(跟踪源实例上的更改并传播到 1 个或多个目标实例)。
如果是这种情况,您可以考虑 Oracle 流(其他选项,例如高级复制,但您需要考虑您的需求):
来自 Oracle:
Oracle does this for you via redo logs, it depends on what you're trying to do with this info. I'm assuming your need is replication (track changes on source instance and propagate to 1 or more target instances).
If thats the case, you may consider Oracle streams (other options such as Advanced Replication, but you'll need to consider your needs):
From Oracle: