- 最后登录
- 2013-9-3
- 在线时间
- 5 小时
- 威望
- 0
- 金钱
- 28
- 注册时间
- 2013-6-15
- 阅读权限
- 10
- 帖子
- 12
- 精华
- 0
- 积分
- 0
- UID
- 1128
|
1#
发表于 2013-7-16 14:46:28
|
查看: 4296 |
回复: 5
有个视图就可以很快创建成功, 但是刷新总是卡住,没有返回:
SQL> exec dbms_mview.refresh('MV_018_A1_LAPSED_CLEA_6W', 'C', ATOMIC_REFRESH=>false) ;
尝试将远程表OMT_018_A1_LAPSED_CLEA_6W@WOW_UAT2DETECT_UAT 拷贝到本地(ctas),修改MView远程表为本地表, 刷新可以很快完成。
以下是视图定义:
CREATE MATERIALIZED VIEW "WOW_DATA"."MV_018_A1_LAPSED_CLEA_6W" ("LYLTY_CARD_NBR", "TIMESTAMP", "AVG_BASKET_SPEND_CAT", "AVG_WEEKLY_SPEND_CAT", "NO_BASKETS_CAT")
ORGANIZATION HEAP PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255
COMPRESS BASIC NOLOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DATA"
BUILD DEFERRED
USING INDEX
REFRESH FORCE ON DEMAND
USING DEFAULT LOCAL ROLLBACK SEGMENT
USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
AS select a.lylty_card_nbr, b."TIMESTAMP", round(sum(tot_amt_incld_gst)/count(distinct txn_id), 2) as AVG_BASKET_SPEND_CAT,
round(sum(tot_amt_incld_gst)/count(distinct trunc(a.start_txn_date, 'day')), 2) as AVG_WEEKLY_SPEND_CAT,
count (distinct txn_id) as NO_BASKETS_CAT
from wow_data.super_item_sales_summary a, OMT_018_A1_LAPSED_CLEA_6W@WOW_UAT2DETECT_UAT b
where
a.lylty_card_nbr = b.entityid
and a.start_txn_date >= trunc(b."TIMESTAMP" - 42, 'day') -35
and to_timestamp(a.start_txn_date || ' ' || a.start_txn_time, 'dd-mon-rr hh24:mi:ss') <= b."TIMESTAMP" - 42
and a.division_nbr in ('03', '07')
and (a.trading_dept_nbr not in ('027', '020') or a.trading_dept_nbr is null)
and (a.fine_dept_nbr != '746' or a.fine_dept_nbr is null)
and a.online_flag != 'Y'
and a.FINE_DEPT_NBR in ('194','195','197','199','202','204','206','208','209')
and start_txn_date >= trunc(sysdate) - (2*6+1)*7
and start_txn_date <= trunc(sysdate) -6*7
group by a.lylty_card_nbr, b."TIMESTAMP";
视图刷新时的trace在附件中
alter session SET tracefile_identifier=mview_trace1;
alter session set events '10046 trace name context forever, level 12';
set autotrace on
exec dbms_mview.refresh('MV_018_A1_LAPSED_CLEA_6W', 'C', ATOMIC_REFRESH=>false) ;
请帮忙分析 , 谢谢 |
|