日期:2014-05-16  浏览次数:20846 次

oracle快照问题
现在有emp表,对emp创建快照日志:
create snapshot log on emp

创建快照实体表s1_emp:
create snapshot s1_emp as select * from emp

对快照实体表s1_emp创建快照日志:
create snapshot log on s1_emp

创建快照实体表s2_emp:
create snapshot s2_emp as select * from s1_emp

对两个快照表设置更新时间1s:
alter snapshot s1_emp refresh fast start with sysdate+1/86400 next sysdate + 1/86400;
alter snapshot s2_emp refresh fast start with sysdate+1/86400 next sysdate + 1/86400;

整体过程为emp---快照--->s1_emp---快照--->s2_emp,更新时间都为1s

现在对emp表进行更新操作
update emp set ename='kxf' where empno=7934;

结果是在s1_emp里数据已更新,而s2_emp数据却没有更新,怎么回事?

------解决方案--------------------
试一下: 第一个和第二个时间 不要同一时间刷新。

If you want to use fast refresh, you should fast refresh all the materialized views
along any chain. It makes little sense to define a fast refreshable materialized
view on top of a materialized view that must be refreshed with a complete
refresh.
If you want the highest level materialized view to be fresh with respect to the
detail tables, you need to ensure that all materialized views in a tree are
join_sales_cust_time
customers sales times products
sum_sales_cust_time join_sales_cust_time_prod

refreshed in the correct dependency order before refreshing the highest-level.
Oracle does not provide support for automatic refreshing of intermediate
materialized views in a nested hierarchy. If the materialized views under the
highest-level materialized view are stale, refreshing only the highest-level will
succeed, but makes it fresh only with respect to its underlying materialized
view, not the detail tables at the base of the tree.


------解决方案--------------------
探讨
试一下: 第一个和第二个时间 不要同一时间刷新。

If you want to use fast refresh, you should fast refresh all the materialized views
along any chain. It makes little sense to define a fast refreshable materialized
view ……

------解决方案--------------------
第二个 要保证在第一完成之后再运行。
还有 我记得 fast refresh 是需要有 log 的吧
s2_emp 不需要吗?
------解决方案--------------------
那你可以测试下 把时间间隔设大点, 看是不时这个原因造成的。
先找到root cause 再说呀。