REFRESH Procedures
This procedure refreshes a list of materialized views.
Syntax
DBMS_MVIEW.REFRESH (
{ list IN VARCHAR2,--list与tab互斥,仅可取其一
| tab IN DBMS_UTILITY.UNCL_ARRAY,}
method IN VARCHAR2 := NULL,--刷新方法,可为:c,f,?,p分别代表:complete,fast,force,a和c相同,p即通过重新计算物化视图基于变化分区从而进行刷新;如list多于method,则采用默认刷新方法
rollback_seg IN VARCHAR2 := NULL,--刷新所有rollback segment
push_deferred_rpc IN BOOLEAN := true,--刷新前把mv变化传播到master table.如不指定,则丢失mv变化;仅用于可更新mv
refresh_after_errors IN BOOLEAN := false,--与下述字典deferror有关;如值为true,即便deferror出错,继续刷新.如atomic_refresh=false则继续刷新其它的物化视图
purge_option IN BINARY_INTEGER := 1,--如为0不清理,1为lazy purge,一般此为最佳配置.2则为更积级性的purge,此应用于
parallelism IN BINARY_INTEGER := 0,--如为0则表示为序列化传播,如为1即为并行传播,大于1同理
--设置此选项为2,可修整队列;适用于多个master复制组被推送到不同的目标站点(高级复制术语).
--而对于一或多个复制组的变化推送并不常发生.此时可配置此参数为0,偶尔配置参数为2可减少
--队列大小
heap_size IN BINARY_INTEGER := 0,--最好不要显式配置此参数,除非在ORACLE支持下;指定并行传播同时检查的最大事务数
atomic_refresh IN BOOLEAN := true,--是否在同一个事务中刷新所有物化视图
nested IN BOOLEAN := false);--如指定为true,则一并刷新依赖的物化视图.
Note:
This procedure is overloaded. The list and tab parameters are mutually exclusive.
C:\Users\123\Desktop\每天工作明细\文档\oracle文档\oracle11g官方文档\appdev.112\e25788\d_mview.htm
SQL> desc deferror;
Name Type Nullable Default Comments
---------------- -------------- -------- ------- -------------------------------------------------
DEFERRED_TRAN_ID VARCHAR2(22) The ID of the transaction that created the error
ORIGIN_TRAN_DB VARCHAR2(128) Y The database originating the deferred transaction
ORIGIN_TRAN_ID VARCHAR2(22) Y The original ID of the transaction
CALLNO NUMBER Y Unique ID of call that caused an error
DESTINATION VARCHAR2(128) Y Database link used to address destination
START_TIME DATE Y Time original transaction enqueued
ERROR_NUMBER NUMBER Y Oracle error number
ERROR_MSG VARCHAR2(2000) Y Error message text
RECEIVER VARCHAR2(30) Y The original receiver of the deferred transaction
SQL> exec dbms_mview.refresh(list => 'mv_t',method => 'f',push_deferred_rpc => true,refresh_after_errors => true,purge_option => 2,parallelism => 3,atomic_refresh => true,nested => true);
PL/SQL procedure successfully completed
SQL> insert into t_mv values(9999);
1 row inserted
--一刷新马上同步到物化视图,即使未提交
SQL> exec dbms_mview.refresh(list => 'mv_t',method => '?',push_deferred_rpc => true,refresh_after_errors => true,purge_option => 2,parallelism => 3,atomic_refresh => true,nested => true);
PL/SQL procedure successfully completed
SQL> select * from mv_t;
A
---------------------------------------
1
2
3
44
888
9999
6 rows selected
SQL> insert into t_mv values(12345);
1 row inserted
SQL> exec dbms_mview.refresh(list => 'mv_t',method => '?',push_deferred_rpc => true,refresh_after_errors => true,purge_option => 2,parallelism => 3,atomic_refresh => false,nested => true);
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-755171/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-755171/