在维护项目时,要求对物化视图(MATERIALIZED VIEW)进行Refresh使用的时间进行测试,在网上找到了下面的例子:
BEGIN
DBMS_MVIEW.REFRESH (
list => 'mview_name', --换成自己的Mview名
Method =>'C',
refresh_after_errors => True);
END;
对上面的意思不理解,通过在PLSQL中查询出如下内容:
-- LIST
-- A comma-separated list or PL/SQL table of the snapshots
-- to be refreshed.
-- METHOD
-- A string that contains a letter for each
-- of the snapshots in the array according to the following codes:
-- '?' -- use fast refresh when possible
-- 'F' -- use fast refresh or raise an error if not possible
-- 'C' -- perform a complete refresh, copying the entire snapshot from
-- the master
-- The default method for refreshing a snapshot is the method stored for
-- that snapshot in the data dictionary.
-- ROLLBACK_SEG
-- The name of the rollback segment to use while
-- refreshing snapshots.
-- PUSH_DEFERRED_RPC
-- If TRUE then push all changes made to an updatable snapshot to its
-- associated master before refreshing the snapshot. Otherwise, these
-- changes may appear to be temporarily lost.
-- REFRESH_AFTER_ERRORS
-- If TRUE, then allow the refresh to proceed
-- even if there are outstanding conflicts logged in the DefError
-- table for the snapshot's master.
-- PURGE_OPTION
-- How to purge the transaction queue if PUSH_DEFERRED_RPC is true.
-- 0 = don't
-- 1 = cheap but imprecise (optimize for time)
-- 2 = expensive but precise (optimize for space)
-- PARALLELISM
-- Max degree of parallelism for pushing deferred RPCs. This value
-- is considered only if PUSH_DEFERRED_RPC is true.
-- 0 = (old algorithm) serial propagation
-- 1 = (new algorithm) parallel propagation with only 1 slave
-- n = (new algorithm) parallel propagation with n slaves
-- HEAP_SIZE
-- The max number of txns to be examined simultaneously for
-- parallel scheduling computation. This parameter is used only if
-- the value of the PARALLELISM parameter is greater than 0.
-- ATOMIC_REFRESH
-- If TRUE, then perform the refresh operations for the specified
-- set of snapshots in a single transaction. This guarantees that either
-- all of the snapshots are successfully refresh or none of the snapshots
-- are refreshed.
PROCEDURE refresh(list IN VARCHAR2,
method IN VARCHAR2 := NULL,
rollback_seg IN VARCHAR2 := NULL,
push_deferred_rpc IN BOOLEAN := TRUE,
refresh_after_errors IN BOOLEAN := FALSE,
purge_option IN BINARY_INTEGER := 1,
parallelism IN BINARY_INTEGER := 0,
heap_size IN BINARY_INTEGER := 0,
atomic_refresh IN BOOLEAN := TRUE);
PROCEDURE refresh(tab IN OUT dbms_utility.uncl_array,
method IN VARCHAR2 := NULL,
rollback_seg IN VARCHAR2 := NULL,
push_deferred_rpc IN BOOLEAN := TRUE,
refresh_after_errors IN BOOLEAN := FALSE,
purge_option IN BINARY_INTEGER := 1,
parallelism IN BINARY_INTEGER := 0,
heap_size IN BINARY_INTEGER := 0,
atomic_refresh IN BOOLEAN := TRUE);
-- -----------------------------------------------------------------------
-- Execute all refresh jobs due to be executed
-- Requires ALTER ANY SNAPSHOT privilege
PROCEDURE refresh_all;
BEGIN
DBMS_MVIEW.REFRESH (
list => 'mview_name', --换成自己的Mview名
Method =>'C',
refresh_after_errors => True);
END;
对上面的意思不理解,通过在PLSQL中查询出如下内容:
-- LIST
-- A comma-separated list or PL/SQL table of the snapshots
-- to be refreshed.
-- METHOD
-- A string that contains a letter for each
-- of the snapshots in the array according to the following codes:
-- '?' -- use fast refresh when possible
-- 'F' -- use fast refresh or raise an error if not possible
-- 'C' -- perform a complete refresh, copying the entire snapshot from
-- the master
-- The default method for refreshing a snapshot is the method stored for
-- that snapshot in the data dictionary.
-- ROLLBACK_SEG
-- The name of the rollback segment to use while
-- refreshing snapshots.
-- PUSH_DEFERRED_RPC
-- If TRUE then push all changes made to an updatable snapshot to its
-- associated master before refreshing the snapshot. Otherwise, these
-- changes may appear to be temporarily lost.
-- REFRESH_AFTER_ERRORS
-- If TRUE, then allow the refresh to proceed
-- even if there are outstanding conflicts logged in the DefError
-- table for the snapshot's master.
-- PURGE_OPTION
-- How to purge the transaction queue if PUSH_DEFERRED_RPC is true.
-- 0 = don't
-- 1 = cheap but imprecise (optimize for time)
-- 2 = expensive but precise (optimize for space)
-- PARALLELISM
-- Max degree of parallelism for pushing deferred RPCs. This value
-- is considered only if PUSH_DEFERRED_RPC is true.
-- 0 = (old algorithm) serial propagation
-- 1 = (new algorithm) parallel propagation with only 1 slave
-- n = (new algorithm) parallel propagation with n slaves
-- HEAP_SIZE
-- The max number of txns to be examined simultaneously for
-- parallel scheduling computation. This parameter is used only if
-- the value of the PARALLELISM parameter is greater than 0.
-- ATOMIC_REFRESH
-- If TRUE, then perform the refresh operations for the specified
-- set of snapshots in a single transaction. This guarantees that either
-- all of the snapshots are successfully refresh or none of the snapshots
-- are refreshed.
PROCEDURE refresh(list IN VARCHAR2,
method IN VARCHAR2 := NULL,
rollback_seg IN VARCHAR2 := NULL,
push_deferred_rpc IN BOOLEAN := TRUE,
refresh_after_errors IN BOOLEAN := FALSE,
purge_option IN BINARY_INTEGER := 1,
parallelism IN BINARY_INTEGER := 0,
heap_size IN BINARY_INTEGER := 0,
atomic_refresh IN BOOLEAN := TRUE);
PROCEDURE refresh(tab IN OUT dbms_utility.uncl_array,
method IN VARCHAR2 := NULL,
rollback_seg IN VARCHAR2 := NULL,
push_deferred_rpc IN BOOLEAN := TRUE,
refresh_after_errors IN BOOLEAN := FALSE,
purge_option IN BINARY_INTEGER := 1,
parallelism IN BINARY_INTEGER := 0,
heap_size IN BINARY_INTEGER := 0,
atomic_refresh IN BOOLEAN := TRUE);
-- -----------------------------------------------------------------------
-- Execute all refresh jobs due to be executed
-- Requires ALTER ANY SNAPSHOT privilege
PROCEDURE refresh_all;