Oracle7 Server Distributed Systems Volume II: Replicated Data

Contents Index Home Previous Next

Understanding Read-Only Snapshots

As shown in Figure 3 - 1, when you create a read-only snapshot, Oracle creates several internal objects in the schema of the snapshot. Do not alter, change data in, or delete these objects manually. At the snapshot site, Oracle creates a base table, named SNAP$_snapshotname, to store the rows retrieved by the snapshot's defining query. For simple snapshots, Oracle also creates an index on the ROWID column of the base table, named I_SNAP$_snapshotname. You should not alter the base table in any way. Do not add triggers or integrity constraints to the base table, unique indexes or modify their contents.

Figure 3 - 1. Snapshot Architecture

Oracle creates a read-only view of the base table that is used whenever you query the snapshot. This view uses the name that you provided when you issued the CREATE SNAPSHOT statement.

Oracle creates a second local view, named MVIEW$_snapshotname, on the remote master table. When you refresh a snapshot, Oracle uses this view to refresh the snapshot. Oracle stores the results of this query in the base table, replacing the previous snapshot data.

For simple snapshots, you can choose to create a snapshot log for the master table. This log is named MLOG$_master_table_name and the trigger used to update this log is named TLOG$_master_table_name. The information in this log allows you to perform a fast refresh of a simple snapshot.

With a fast refresh, only the changed rows of the snapshot, as indicated by the snapshot log, need to be updated. Each time that you make a change to the master table, Oracle tracks that change in the snapshot log, including the ROWID of the changed row. The generated index (I_SNAP$_) on the ROWID column of the base table allows these changes to be quickly applied to the snapshot. A complex snapshot, or a simple snapshot without a snapshot log, must be completely regenerated from the master table every time you refresh the snapshot. This is known as a complete refresh.

You should not drop the generated index. If you will never perform a fast refresh of the snapshot and do not want this index created, you can create your snapshot as a complex snapshot, for example by joining with DUAL.

A snapshot log can be used by multiple simple snapshots of a single master table. After you refresh a snapshot, any rows in the snapshot log that do not apply to any other snapshots of that master are removed from the snapshot log.


Contents Index Home Previous Next