一个大实体化视图的刷新(无法执行全量刷新)。

  Step   Task

 

 

  1

remove summary Mv from refresh group.
exec dbms_refresh.subtract(name=>'SGREPORTS_REPG', list=>'METRIC_DATA_HOURLY');

 

 

 

 2

get the definition of the Mv.
  SQL> set long 100000 pagesize 0
  SQL> select dbms_metadata.get_ddl('MATERIALIZED_VIEW','METRIC_DATA_HOURLY','SGREPORTS') from dual;

 

 

 

 3

drop Mv but preserve the prebuilt table.
drop materialized view METRIC_DATA_HOURLY preserve table;

 

 

 4

 

alter table sgreports.metric_data_hourly truncate partition metric_data_hourly_2009_mar update global indexes;

 

 

 

 5

On master site:
drop and recreate the MV log.
Create table metric_data_hourly_mar as select * from metric_data_hourly partition (metric_data_hourly_2009_Mar);
grant select on  metric_data_hourly_mar to smcrep;
On replication site:
create table metric_hold tablespace LG_DATA
 as select /*+ NOPARALLEL(sgreports.metric_data_hourly_mar) */ *
 from sgreports.metric_data_hourly_mar@RPTS.NILE002A_ZONE01.EAST; 
insert /*+APPEND */ into metric_data_hourly
 select * from metric_hold; 

 

 

 6

 

recreate the Mv with the sql got by step 2.
CREATE MATERIALIZED VIEW sgreports.metric_data_hourly on prebuilt table
REFRESH fast with primary key
AS select *
FROM sgreports.metric_data_hourly@RPTS.NILE002A_ZONE01.EAST;

 

 

7

remove the metric_data_hourlyMv from default refresh group.
exec dbms_refresh.subtract(name=>'metric_data_hourly', list=>'metric_data_hourly');

 

 

8

 

 

add the mv back to the refresh group.
BEGIN
DBMS_REFRESH.ADD (name=>'sgreports_repg',list=>'metric_data_hourly');
END;
/

 

 

9

 

 

refresh manually.
exec dbms_mview.refresh('metric_data_hourly','F');
commit;

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值