小技巧 - 如何刷新K/3 Cloud Oracle 数据库的物化视图
金蝶云社区-JohnnyDing
JohnnyDing
0人赞赏了该文章 3,070次浏览 未经作者许可,禁止转载编辑于2016年04月20日 16:58:34

如果客户采用的是Oracle数据库,为了提升性能,K/3 Cloud 对很多常用视图,创建的是物化视图。

这在性能上非常有优势。

但是,这样处理的一个弊端,就是经常出现物化视图没有即时更新,未覆盖完整的原始数据,导致应用问题。

此时,可以在PL/SQL查询工具的Command Window下执行如下SQL语句,刷新物化视图:

create materialized view log on T_BD_BANK with rowid;
create materialized view log on T_BD_BANK_L with rowid;
create materialized view log on T_BD_CUSTOMER with rowid;
create materialized view log on T_BD_CUSTOMER_L with rowid;
create materialized view log on T_BD_DEPARTMENT with rowid;
create materialized view log on T_BD_DEPARTMENT_L with rowid;
create materialized view log on T_BD_SUPPLIER with rowid;
create materialized view log on T_BD_SUPPLIER_L with rowid;
create materialized view log on T_FIN_OTHERS with rowid;
create materialized view log on T_FIN_OTHERS_L with rowid;
create materialized view log on T_HR_EMPINFO with rowid;
create materialized view log on T_HR_EMPINFO_L with rowid;
create materialized view log on T_ORG_ORGANIZATIONS with rowid;
create materialized view log on T_ORG_ORGANIZATIONS_L with rowid;

exec dbms_mview.refresh('V_FIN_CONTACTTYPE','c');
exec dbms_mview.refresh('V_ITEMCLASS_OWNER','c');
exec dbms_mview.refresh('V_ITEMCLASS_KEEPER','c');
exec dbms_mview.refresh('V_FIN_CONTACTTYPE_L','c');
exec dbms_mview.refresh('V_ITEMCLASS_KEEPER_L','c');
exec dbms_mview.refresh('V_ITEMCLASS_OWNER_L','c');
exec dbms_mview.purge_mview_from_log();

特别说明:现场执行exec开头的语句即可