Oracle7 Server Distributed Systems Volume II: Replicated Data

Contents Index Home Previous Next

Using Snapshot Refresh Groups

This section describes the procedures provided in the DBMS_REFRESH package that allow you to create, alter, and delete refresh groups. For more information on automatically refreshing snapshots, see [*]. These procedures should be called from the site where your snapshots are located (not from the site of their associated master tables).

Creating a Refresh Group

To specify the members of a refresh group and the time interval used to determine when the members of this group should be refreshed, call the MAKE procedure of the DBMS_REFRESH package, as shown in the following example:

DBMS_REFERESH.MAKE(
    name             => 'acctg', 
    list             => 'acct_rec, acct_pay',
    next_date        => SYSDATE, 
    interval         => 'SYSDATE + 1/24',
    implicit_destroy => TRUE);

This example creates the ACCTG refresh group with two members, ACCT_REC and ACCT_PAY, that will be refreshed every hour. Additional information on setting the refresh interval is provided [*].

The type of refresh performed is determined by the mode that you specified when you created each snapshot. If you did not specify a refresh mode for a snapshot, Oracle performs a fast refresh if possible; otherwise, it performs a complete refresh.

Additional Information: The parameters for the MAKE procedure are described in Table 12 - 59.

Altering a Refresh Group

The DBMS_REFRESH package contains separate procedures for adding new members to a refresh group, removing members from a refresh group, and altering the automatic refresh interval for a refresh group.

Adding Members to a Refresh Group

To add snapshots to a refresh group, call the ADD procedure in the DBMS_REFRESH package, as shown in the following example:

DBMS_REFRESH.ADD( name => 'acctg', 
                  list => 'acct_bill', 
                  lax  => TRUE);

This example adds the ACCT_BILL snapshot to the ACCTG refresh group. Setting the last argument to TRUE lets ACCT_BILL be added to ACCTG even if it must first be removed from another group.

Additional Information: The parameters for the ADD procedure are described in Table 12 - 56.

Removing Members from a Refresh Group

To remove snapshots from a refresh group, call the SUBTRACT procedure in the DBMS_REFRESH package, as shown in the following example:

DBMS_REFRESH.SUBTRACT( name => 'acctg', 
                       list => 'acct_bill');

This example removes the ACCT_BILL snapshot from the ACCTG refresh group. This snapshot will no longer be automatically refreshed. After removing a snapshot from a refresh group, you should either refresh it manually or add it to another refresh group.

If you set IMPLICIT_DESTROY to TRUE in the MAKE call for the refresh group, Oracle automatically deletes the group whenever you subtract the last member.

Additional Information: The parameters for the SUBTRACT procedure are described in Table 12 - 61.

Altering the Refresh Interval

If you want to change how often a snapshot group is refreshed (for example, if you want the snapshots refreshed once a day as opposed to once a week), call the CHANGE procedure in the DBMS_REFRESH package as shown in the following example:

DBMS_REFRESH.CHANGE( name      => 'acctg', 
                     next_date => SYSDATE, 
                     interval  => 'SYSDATE + 1');

This example changes the refresh interval of the ACCTG group to once a day.

Additional Information: The parameters for the CHANGE procedure are described in Table 12 - 57.

Deleting a Refresh Group

If you want to remove all of the snapshots from a refresh group and delete the refresh group, call the DESTROY procedure in the DBMS_REFRESH package, as shown in the following example:

DBMS_REFRESH.DESTROY( name => 'acctg');

This example removes all of the snapshots from the ACCTG refresh group. These snapshots will no longer be automatically refreshed. You must either refresh these snapshots manually, or add the snapshots to new refresh groups.

Additional Information: The parameters for the DESTROY procedure are described in Table 12 - 58.


Contents Index Home Previous Next