在 Oracle 中跟踪物化视图更改的最佳方法是什么。我知道,触发器是可用的,而且 CDC 似乎不适用于物化视图。有什么聪明的解决办法吗?
谢谢你的帮助
约翰内斯
在 Oracle 中跟踪物化视图更改的最佳方法是什么。我知道,触发器是可用的,而且 CDC 似乎不适用于物化视图。有什么聪明的解决办法吗?
谢谢你的帮助
约翰内斯
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. If the MV is in a different database you'll have a problem.
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. There's a fuzziness of +/- 3 seconds in rowscn timestamps so if you need greater precision you're looking at rolling your own solution.
如果存在,您可能可以查询 MV 日志本身: