dbms_mview系列(四)

wisdomone1發表於2013-03-03

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章