首页 > 代码库 > 物化视图

物化视图

物化视图基本操作

创建物化视图日志
create materialized view log on cps_identity_account  including new values;

删除物化视图日志
drop materialized view log on cpsmgt.cps_identity_account;

创建视图
----(1)-----有主键
create materialized view mv_cps_identity_account
refresh fast on demand
as
select * from
from cpsmgt.cps_identity_account@ic;

----(2)-----没有主键和索引
create materialized view lbi_ods.mv_cps_trans_record
refresh fast on demand with rowid
as
select * from cps_trans_record@tc;


------------删除视图
drop materialized view  mv_cps_identity_account;


------------刷新视图(原表不含分区)
create or replace procedure prc_o_mv_cps_identity_account(         iv_min     in varchar2/*,
                                                  oi_return out integer*/)
     authid current_user
/** head
  * @name lbi_ods.prc_o_mv_cps_customer_account
  * @caption
  * @type   collected by every 5 minutes
  * @parameter iv_date in varchar2   statis date, format:yyyymmdd
  * @parameter oi_return out integer   execute state: 0 means ok ; others means error.
  * @target lbi_ods#mv_test
  * @version 2.0
  * @author liuzan
  * @create-date 2013-08-22
  * @todo
  * @version
  * @mender <>
  * @modify_date <YYYY-M-D>
  * @modify_desc <>
  * @copyright HUAWEI
  */

 is

begin
    ---refresh mv data
    dbms_mview.refresh(‘MV_CPS_IDENTITY_ACCOUNT‘,‘f‘);
    commit;
end ;

物化视图