删物化视图 删分区

DROP MATERIALIZED VIEW LOG ON $tab_name;
DROP MATERIALIZED VIEW $mv_name;

alter table $tab_name drop partition P1005010000;

//关闭,启动任务
exec dbms_scheduler.enable('存储过程名字');
exec dbms_scheduler.disable(存储过程名字'');


create materialized view log on OFFENCEHTTP1URL  with rowid
  

/*t.OFFENCEDOMAIN,POLICYGRPID,DEVICEID,IPLOCAL,DSTIP,PROTOCOLID,TOTALHITCNT,HITCNT1 */


alter materialized view log on OFFENCEHTTP1URL add including new values;

alter materialized view log on OFFENCEHTTP1URL add (OFFENCEDOMAIN);
alter materialized view log on OFFENCEHTTP1URL add (POLICYGRPID);
alter materialized view log on OFFENCEHTTP1URL add (DEVICEID);
alter materialized view log on OFFENCEHTTP1URL add (IPLOCAL);
alter materialized view log on OFFENCEHTTP1URL add (DSTIP);
alter materialized view log on OFFENCEHTTP1URL add (PROTOCOLID);
alter materialized view log on OFFENCEHTTP1URL add (TOTALHITCNT);
alter materialized view log on OFFENCEHTTP1URL add (HITCNT1);


create materialized view MV_URLLIST
refresh fast on commit
as
select /*+ parallel (ou 4) */
           Offencedomain,PolicyGrpID,deviceid,iplocal,Dstip,protocolid,
           sum(totalhitcnt) StatHitCnt,
           count(totalhitcnt) cnt1,
           count(hitcnt1) cnt2,
           count(*) cnt3
      from Offencehttp1url ou
     group by Offencedomain, deviceid,iplocal,Dstip,PolicyGrpID,protocolid;



你可能感兴趣的:(物化视图)