简体   繁体   English

跟踪Oracle中物化视图的更改

[英]Track changes on materialized views in Oracle

what is the best way to track changes of a materialized views in Oracle. 跟踪Oracle中实例化视图更改的最佳方法是什么。 I know, that triggers are available and CDC does not seem to work with materialized views. 我知道,触发器是可用的,而CDC似乎不适用于实例化视图。 Are there any clever solutions? 有什么聪明的解决方案吗?

Thanks for your help 谢谢你的帮助

Johannes 约翰尼斯

I assume you are talking about identifying the changes that happen in incrementally-refreshed materialized views. 我假设您正在谈论确定增量刷新的物化视图中发生的更改。 If the MV is in the same database as the underlying tables you can define an extra column, say LAST_UPDATED, in the result set that stores the value of sysdate or systimestamp. 如果MV与基础表位于同一数据库中,则可以在存储sysdate或systimestamp值的结果集中定义一个额外的列,例如LAST_UPDATED。 If the MV is in a different database you'll have a problem. 如果MV位于其他数据库中,则会出现问题。

I actually just received a patch from Oracle that fixes a bug to allow persisting ROWSCN (and therefore the ROWSCN timestamp) into the remote MV, so this should be an option for distributed MV's. 实际上,我刚刚从Oracle那里收到了一个补丁,该补丁修复了一个错误,该错误允许将ROWSCN(并因此将ROWSCN时间戳)持久保存到远程MV中,因此这应该是分布式MV的一种选择。 There's a fuzziness of +/- 3 seconds in rowscn timestamps so if you need greater precision you're looking at rolling your own solution. rowcn时间戳的模糊性为+/- 3秒,因此,如果需要更高的精度,可以考虑使用自己的解决方案。

You could probably query the MV log itself, if present: 您可能会查询MV日志本身(如果存在):

http://www.sqlsnippets.com/en/topic-12878.html http://www.sqlsnippets.com/en/topic-12878.html

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

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