溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

oracle物化視圖快速更新

發(fā)布時間:2020-08-10 20:22:06 來源:網(wǎng)絡 閱讀:683 作者:snowhill 欄目:關系型數(shù)據(jù)庫

建立測試表

create table T_table nologging as select * from dba_objects;
create table t_table_1 nologging as select * from dba_tables;

--建立日志記錄

create materialized view log on T_table with rowid ,sequence(object_name,object_type,owner) including new values;
create materialized view log on t_table_1 with rowid,sequence(table_name)  including new values;

--建立物化視圖

create materialized view mv_t_table nologging 
refresh fast on demand 
with rowid 
START WITH TO_DATE('21-08-2017 10:09:08', 'DD-MM-YYYY HH24:MI:SS') NEXT SYSDATE + 1/(24*60) 
as select count(*),a.object_type,a.owner from T_table a,t_table_1 b  where a.object_name=b.table_name 
group by a.object_type,a.owner


--測試

select * from mv_t_table where owner='SYSTEM';
delete from t_table where owner='SYSTEM';
insert into t_table select * from dba_objects where  owner='SYSTEM';


--查看日志生成量

select a.name, b.value from v$statname a, v$mystat b where a.statistic# = b.statistic# and a.name = 'redo size';


--查看刷新日志

SELECT owner,mview_name,last_refresh_scn,last_refresh_date,query,REVISION FROM dba_mview_analysis WHERE owner='UTF32';

--查看日志記錄表,MLOG$為日志記錄表,一旦更新完成,此表的內(nèi)容會被清掉;

select * from MLOG$_T_TABLE
select * from MLOG$_T_TABLE_1;

官方說明參見:http://docs.oracle.com/cd/E11882_01/server.112/e10706/repmview.htm#REPLN265

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI