14.2 DBMS_REFRESH: Managing Snapshot GroupsThe DBMS_REFRESH package contains procedures for administrating snapshot groups.. A snapshot group is a collection of one or more snapshots tha
Trang 1Copyright (c) 2000 O'Reilly & Associates All rights reserved.
[Appendix A] What's on the Companion Disk?
Trang 214.2 DBMS_REFRESH: Managing Snapshot Groups
The DBMS_REFRESH package contains procedures for administrating snapshot groups A snapshot group is
a collection of one or more snapshots that Oracle refreshes in an atomic transaction, guaranteeing that
relationships among the master tables are preserved in the snapshot tables The DBMS_REFRESH package includes packages that perform the following functions:
•
Create and destroy snapshot groups
•
Add and subtract snapshots from snapshot groups
•
Manually refresh snapshot groups
•
Change properties of the snapshot group, such as the refresh interval
Figure Figure 14.1 shows how DBMS_REFRESH works and Figure Figure 14.2 illustrates snapshot groups
Figure 14.1: DBMS_REFRESH components
617
Trang 3Figure 14.2: A snapshot group
14.2.1 Getting Started with DBMS_REFRESH
The DBMS_REFRESH package is created when the Oracle database is installed The dbmssnap.sql script
(found in the built−in packages source directory, as described in Chapter 1) contains the source code for this
package's specification This script is called by catproc.sql, which is normally run immediately after database
creation The script creates the public synonym DBMS_REFRESH for the package and grants EXECUTE privilege on the package to public All Oracle users can reference and make use of this package
[Appendix A] What's on the Companion Disk?
Trang 4Table 14−3 lists the programs available in the DBMS_REFRESH package.
Table 14.3: DBMS_REFRESH Programs
SQL?
DBMS_REFRESH does not define any exceptions
14.2.2 Creating and Destroying Snapshot Groups
The MAKE and DESTROY procedures create and destroy snapshot groups, respectively You call these procedures from the snapshot site
14.2.2.1 The DBMS_REFRESH.MAKE procedure
Call the MAKE procedure to create a snapshot group Note that you must select either the list or tab
parameter, but not both The specifications for Oracle7 and Oracle8 versions differ as follows
Here is the Oracle7 specification:
PROCEDURE DBMS_REFRESH.MAKE
(name IN VARCHAR2,
{list IN VARCHAR2,| tab IN dbms_utility.uncl_array,}
next_date IN DATE,
interval IN VARCHAR2,
implicit_destroy IN BOOLEAN DEFAULT FALSE,
lax IN BOOLEAN DEFAULT FALSE,
job IN BINARY_INTEGER DEFAULT 0,
rollback_seg IN VARCHAR2 DEFAULT NULL,
push_deferred_rpc IN BOOLEAN DEFAULT TRUE,
refresh_after_errors IN BOOLEAN DEFAULT FALSE );
Here is the Oracle8 specification:
PROCEDURE DBMS_REFRESH.MAKE
(name IN VARCHAR2,
{list IN VARCHAR2,| tab IN dmbs_utility.uncl_array,}
next_date IN DATE,
interval IN VARCHAR2,
implicit_destroy IN BOOLEAN := FALSE,
lax IN BOOLEAN := FALSE,
job IN BINARY_INTEGER := 0,
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,
Trang 5heap_size IN BINARY_INTEGER := 0);
In both Oracle7 and Oracle8, the MAKE procedure is overloaded; you can supply the list of snapshots either
as a comma−separated string with the list parameter, or as a PL/SQL table with the tab parameter
Parameters are summarized in the following table
list or tab to specify the snapshot(s) you want to add
to specify the snapshot(s) you want to add
implicit_destroy If set to TRUE, the snapshot group is destroyed if all snapshots are removed from it
snapshot(s) are first removed from the other group
rollback_seg Specifies the rollback segment to use during snapshot refreshes If set to NULL, the
default rollback segment is used
push_deferred_rpc For updateable snapshots only Setting this parameter to TRUE indicates that local
updates will be pushed back to the master site (otherwise, local updates will not be visible during the refresh)
refresh_after_errors For updateable snapshots only Setting this parameter to TRUE indicates that refreshes
should occur even if errors exist in the DEFERROR data dictionary view
purge_option
(Oracle8 only)
If push_deferred_rpc is TRUE, this designates the purge method; default is 1.
•
0 No purge
•
1 Lazy purge (optimized for time)
•
2 Aggressive purge (complete) parallelism
(Oracle8 only)
•
If push_defered_rpc is TRUE, this determines the maximum degree of parallelism; default is 1
•
0 Serial
•
1 Parallel with 1 slave
•
N Parallel with N slaves (N > 1)
[Appendix A] What's on the Companion Disk?