我想在我创建的物化视图上执行和更新。 并且需要在远程表中执行更新。
以下是我要归档的步骤。
视图上有一个刷新,每分钟发生一次, 但视图中所做的更改将被丢弃, 基表中所做的更改将被拉入视图。
我的要求是更新基表!我在这里缺少什么?
CREATE TABLE ITEM_MASTER (ID NUMBER PRIMARY KEY, ITEM_NAME VARCHAR2(200),PRICE NUMBER(12,2));
CREATE MATERIALIZED VIEW LOG ON HUDHAIFA.ITEM_MASTER
TABLESPACE users
WITH PRIMARY KEY
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW ITEM_MV
REFRESH FAST WITH PRIMARY KEY FOR UPDATE
AS
SELECT * FROM ITEM_MASTER;
CREATE MATERIALIZED VIEW ITEM_MV FOR UPDATE
AS
SELECT * FROM ITEM_MASTER;
BEGIN
DBMS_STATS.gather_table_stats(
ownname => 'HUDHAIFA',
tabname => 'ITEM_MV');
END;
BEGIN
DBMS_REFRESH.make(
name => 'HUDHAIFA.MINUTE_REFRESH',
list => '',
next_date => SYSDATE,
interval => '/*1:Mins*/ SYSDATE + 1/(60*24)',
implicit_destroy => FALSE,
lax => FALSE,
job => 0,
rollback_seg => NULL,
push_deferred_rpc => TRUE,
refresh_after_errors => TRUE,
purge_option => NULL,
parallelism => NULL,
heap_size => NULL);
END;
/
BEGIN
DBMS_REFRESH.add(
name => 'HUDHAIFA.MINUTE_REFRESH',
list => 'HUDHAIFA.ITEM_MV',
lax => TRUE);
END;
/
EXEC DBMS_MVIEW.refresh('ITEM_MV');