Oracle7 Server Distributed Systems Volume II: Replicated Data

Contents Index Home Previous Next

Using Snapshots

Snapshots are queried just like a table or view. For example, the following statement queries a snapshot named EMP:

SELECT * FROM emp;

Attention: Never manipulate data in the base table of a read-only snapshot.

You cannot issue any INSERT, UPDATE, or DELETE statements when using a read-only snapshot; if you do, an error is returned. Although INSERT, UPDATE, and DELETE statements can be issued against the base table for a snapshot, they can corrupt the snapshot. Updates are allowed on the master table only, which must then be refreshed to update the snapshot. If you want to alter the snapshot, you must create it as an updatable snapshot as described in Chapter 5.

Creating Views and Synonyms Based on Snapshots

Views or synonyms can be defined based on snapshots. The following statement creates a view based on the EMP snapshot:

CREATE VIEW sales_dept AS
   SELECT ename, empno
   FROM emp
   WHERE deptno = 10;

Privileges Required to Use a Snapshot

To query a snapshot, you must have the SELECT object privilege for the snapshot, either explicitly or via a role.


Contents Index Home Previous Next