我使用DB链接创建了物化视图。 我正面临Oracle 11g2物化视图的一个奇怪问题。当第一次调用时,它有时根据源表更改不反映更改(插入和更新)。当第二次调用相同的MV时,它工作正常。行数可能超过50,000。
请找到MV创建脚本。
CREATE MATERIALIZED VIEW "EMRSODEVAPPUSER"."MV_BM_PNS" ("BM_UNIT", "DATETIME_FROM", "DATETIME_TO", "LEVEL_FROM", "LEVEL_TO")
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
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 "EMRSODEVTBS"
BUILD IMMEDIATE
USING INDEX
REFRESH FORCE ON DEMAND NEXT null
USING DEFAULT LOCAL ROLLBACK SEGMENT
USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
AS (select * from (select * from BM_PNS@TRSP04));
COMMENT ON MATERIALIZED VIEW "EMRSODEVAPPUSER"."MV_BM_PNS" IS 'snapshot table for snapshot EMRSODEVAPPUSER.MV_BM_PNS';
This is called by DBMS refresh group:
Create the group :
DBMS_REFRESH.MAKE(
name=>'MV_REFRESH_GROUP',
LIST=>'MV_BM_PNS',next_date => SYSDATE, INTERVAL => 'null');
END;
/
Execute the group :
execute dbms_refresh.refresh('MV_REFRESH_GROUP');
提前致谢!