什么会导致Oracle 10g中的物化视图停止快速刷新?
如果我在 Oracle 中有一个物化视图,它被定义为每 15 分钟REFRESH FAST ON COMMIT
。它在最初创建时就可以工作并且刷新愉快。什么会导致它停止快速刷新?
我可以看到它已经停止刷新:
select mview_name, last_refresh_date from all_mviews;
If I have materialized view in Oracle which is defined as REFRESH FAST ON COMMIT
every 15 minutes. It works when initially created and refreshes happily. What can cause it to stop fast refreshing?
I can see that it has stopped refreshing based on this:
select mview_name, last_refresh_date from all_mviews;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们发现的一些事情似乎阻止了 MV 的刷新:
1. 基表DDL的改变
2.如果MV是跨DB链接的,那么跨链接获取数据就会出现问题(比如我们这里有一个数据库,还有一个远程的。如果在刷新的时候,两个数据库之间的连接失败了,那么刷新的时候就会出现问题)失败)
在#1 的情况下,刷新失败并且再也无法工作,我们必须重新创建 MV。在#2 的情况下,尚不清楚刷新是否会再次恢复。
事实证明,快速刷新 MV 对我们来说并不可靠,因此我们在 Windows 调度程序中创建了一个作业来启动刷新。
Things we've found seem to stop an MV from refreshing:
1. a change to the base table's DDL
2. if the MV is across a DB link, a problem with getting the data across the link (for example, we had a database here, and one remote. If during a refresh, the connection between the two databases failed, then the refresh failed)
In the case of #1, the refresh fails and never ever works again and we have to recreate the MV. In the case of #2, its been unclear if the refresh will ever pick up again.
Fast refresh MVs have proved to be unreliable for us so we've created a job in Windows scheduler to initiate our refreshes.
在我上一份工作中偶尔发生的一件事是,DBA 活动有时会将参数 job_queue_processes 设置为 0。这将停止物化视图刷新,直到参数值设置为大于 0 的值。
A thing that occasionally happened during my last job was, that DBA activity sometimes set the parameter
job_queue_processes
to 0. This will stop materialized view refreshing until the parameter value is set to something greater than 0.这取决于物化视图。以下来自 Oracle 数据字典的查询将为您提供所有(Oracle 用户)物化视图的列表以及它们的刷新速度。
FAST_REFRESHABLE 列将为您提供以下值之一:
否:物化视图不能快速刷新,因此很复杂。
DIRLOAD:仅直接加载支持快速刷新。
DML:仅 DML 操作支持快速刷新。
DIRLOAD_DML:直接加载和 DML 操作都支持快速刷新。
DIRLOAD_LIMITEDDML:支持直接加载和 DML 操作子集的快速刷新。
过去给我带来问题的是DIRLOAD_LIMITEDDML。如果 MVIEW 查询中有 COUNT、MAX 等,我通常会得到这些。通常这些会在插入和删除时刷新,但不会在更新时刷新。
It depends on the materialized view. The following query from the oracle data dictionary will give you a list of all your (the oracle user's) materialized views and how fast refreshable they are.
The FAST_REFRESHABLE column will give you one of the following values:
NO: The materialized view is not fast refreshable, and hence is complex.
DIRLOAD: Fast refresh is supported only for direct loads.
DML: Fast refresh is supported only for DML operations.
DIRLOAD_DML: Fast refresh is supported for both direct loads and DML operations.
DIRLOAD_LIMITEDDML: Fast refresh is supported for direct loads and a subset of DML operations.
The ones that have given me problems in the past have been DIRLOAD_LIMITEDDML. I have usually gotten those if there is a COUNT, MAX, etc... in the MVIEW query. Usually these refresh on inserts and deletes but not on updates.