Oracle8i Replication Release 8.1.5 A67791-01 |
|
This chapter explains how to build a snapshot environment while directly connected to the remote snapshot site. Instead of pre-creating the snapshot environment at a master site with deployment templates, this chapter will illustrate how to build the snapshot environment directly at the remote snapshot site. This chapter covers the following topics:
If deployment templates do not meet your requirements for building and distributing a snapshot environment, you have two other options:
This chapter will describe the concepts and procedures of building a snapshot site using Oracle's Replication Manager.
Before you can begin to replicate using snapshots, you need to setup your remote snapshot site to support replication. Oracle's Replication Manager contains a wizard that allows you to quickly and easily prepare your remote site to support snapshots.
Complete the following steps to setup your remote snapshot site:
This is the site that contains the master objects for your snapshot site (this site will be the target for the database links created at the snapshot site).
SYSTEM
(at the master site) in the SYSTEM Password field and press the Next button.
SYSTEM
(at the site specified in step 6) in the Password field and press the Add button (down arrow).
To maintain security between the master and snapshot site, you are encouraged to change the default password (SNAPADMIN) to another alphanumeric password of at least 8 characters in length.
Press the <SHIFT> key to select a range of schema or press the <CTRL> key to individually select multiple schema.
In most cases you will only modify the Schedule settings. These settings control how often the deferred transaction queue is pushed to the target master site and the snapshot is refreshed.
Press the Help button to view details about the individual settings on this page.
The Purge Job Scheduling settings define how often the deferred transaction queue is purged. Typically once a day (sysdate +1/24) is adequate for most replication installations.
Press the Help button to view details about the individual settings on this page.
The Customize feature is helpful if you are using the Setup Wizard to configure more than one snapshot site at a time.
If you do customize a default site, you will notice that you can select the available tabs to modify the settings specified during the Setup Wizard.
Press the OK button to complete the customization and return to the Setup Wizard.
If you would like Replication Manager to record a script instead of building the actual snapshot site, enable the Record Script checkbox.
Replication Manager will now build (or generate a script for) your snapshot site with the setting you defined during the Setup Wizard.
A snapshot group in an advanced replication system maintains a partial or complete copy of all or some of the objects in a corresponding master group. Replication Manager has many features that help you create and manage snapshot groups. The following sections explain more about creating snapshot groups.
Before you create a new snapshot group, make sure that the following preliminary tasks have been completed.
To create a new snapshot group:
If you do not see the target database, you may need to close Replication Manager and relogin to the snapshot site.
You can optionally press the Create Snapshot Group button on the toolbar.
The database link will use the global database name of the target database.
Press the <SHIFT> key to select a range of objects or press the <CTRL> key to individually select multiple objects.
If you selected multiple tables in step 8 to become snapshots, the following settings will be applied to each of those generated snapshots.
Min Communications: Reduces the amount of data required to support conflict resolution mechanisms. This feature should only be enabled for Oracle8 and greater databases.
Fast Refresh: Snapshot will be refreshed using the FAST refresh method (see "Refresh Types" on page for details).
Updateable: Allows users to modify the contents of a snapshots and have those changes propagated to the target master table. (See the "Primary Key" section on page for additional information.)
Use a storage clause: Allows user to define custom storage settings for the generated snapshots. If enabled, you can modify the extents, space usage, and number of transaction settings. Press the Edit button to modify these settings and see "Using a Storage Clause" on page for detailed information.
Whereas the previous page of the wizard allowed you to define global snapshot settings, this page allows you to individually modify snapshot settings.
Min Communications: Reduces the amount of data required to support conflict resolution mechanisms. This feature should only be enabled for Oracle8 and greater databases.
Updateable: Allows users to modify the contents of a snapshot and have those changes propagated to the target master table. (See the "Primary Key" section on page for additional information.)
Fast Refresh: Snapshot will be refreshed using the FAST refresh method (see "Refresh Types" on page for details).
Use a WHERE clause: Snapshot will contain a data subset of the target master table; this is helpful if you want to replicate only a range of data to the snapshot site. Press the Edit button to define the WHERE clause and see "Using a WHERE Clause" on page for detailed information.
Use a storage clause: Allows user to define custom storage settings for the generated snapshots. If enabled, you can modify the extents, space usage, and number of transaction settings. Press the Edit button to modify these settings and see "Using a Storage Clause" on page for detailed information.
Minimizing Data Propagation |
---|
The Minimize Communication setting lets you determine how much data snapshot sites must transfer to perform conflict detection for an updateable snapshot (primary key snapshots only). When you use the default setting, to minimize communication, Oracle propagates only the new values for updated columns plus the old values of the primary key and the columns in each updated column group. Note: The default setting, to minimize communication, is valid only for Oracle8 and greater databases. When you base an updateable snapshot on a master table in an Oracle7 release 7.3 database, you must disable the Minimize Communication setting. When disabled, Oracle propagates the old and new values of all columns in a row when any column in the row is updated. This is the behavior expected by Oracle7 release 7.3. Additional Information: See "Minimizing Data Propagation for Update Conflict Resolution". |
Replication Manager will now build your snapshot group with the objects and settings that you defined using the Create Snapshot wizard.
As described in Chapter 3, "Snapshot Concepts & Architecture", snapshots may contain data subsets of a target master table (see "Data Subsetting with Snapshots" on page for additional information). The Using a WHERE Clause feature allows you to define the data subset for an individual snapshot.
If you enable the Using a WHERE Clause checkbox in step 12 of the "Creating Snapshot Groups" section (page ) and press the Edit button, then you will see the screen illustrated in Figure 5-7.
There are two methods of defining your WHERE clause:
Complete the following steps to manually define your WHERE clause:
Complete the following steps to define your WHERE clause:
As you add elements, you will see them appear in the Where Clause field below the lists of elements.
If you enable the Use Storage Clause checkbox in steps 10 or 12 of the "Creating Snapshot Groups" section (page ) and press the Edit button, then you will see the Snapshot Storage screen illustrated in Figure 5-8. Use this screen to modify the storage characteristics of your snapshots(s).
For detailed information, see the references mentioned in the following descriptions:
After you have created your snapshot groups, you may need to add, alter, or delete replicated objects. You may also need to alter the characteristics of your snapshot group and, at times, you may even need to delete a snapshot group. The following sections will describe how to use Oracle's Replication Manager to manage your snapshot groups.
Before you begin working with your snapshot groups, make sure that you are connected to the remote snapshot site. If you are not connected, you may need to disconnect and relogin to the target database.
To edit a snapshot group:
You will now be able to modify the snapshot group settings and add or remove objects to or from your snapshot group. Please complete the steps in one of the following sections to modify your snapshot group: "Alter Snapshot Group Settings", "Adding Objects to a Snapshot Group", or "Deleting Objects from a Snapshot Group".
The General tab of the Snapshot Group property sheet allows you to change the propagation type and the target master group database. Complete the following steps to modify these settings:
If you are not sure what TNSNAMES alias to enter, press the Browse button to select from a list of existing database links.
Changing the Link to Master database is very useful if the current target database is no longer available and you need to point your snapshot database to an alternate master database.
To add objects to a snapshot group:
You will see a list of all objects that are currently contained in the selected snapshot group (the schema, name, and type properties will be displayed for each object).
The Snapshot Group Edit Wizard will appear.
Press the <SHIFT> key to select a range of objects or press the <CTRL> key to individually select multiple objects.
If you selected multiple tables in step 4 to become snapshots, the following settings will be applied to each of those generated snapshots.
Min Communications: Reduces the amount of data required to support conflict resolution mechanisms. This feature should only be enabled for Oracle8 and greater databases.
Fast Refresh: Snapshot will be refreshed using the FAST refresh method (see "Refresh Types" on page for details).
Updateable: Allows users to modify the contents of a snapshot and have those changes propagated to the target master table. (See the "Primary Key" section on page for additional information.)
Use a storage clause: Allows user to define custom storage settings for the generated snapshot. If enabled, you can modify the extents, space usage, and number of transaction settings. Press the Edit button to modify these settings and see "Using a Storage Clause" on page for detailed information.
Whereas the previous page of the wizard allowed you to define global snapshot settings, this page allows you to individually modify snapshot settings.
Min Communications: Reduces the amount of data required to support conflict resolution mechanisms. This feature should only be enabled for Oracle8 and greater databases.
Updateable: Allows users to modify the contents of a snapshot and have those changes propagated to the target master table. (See the "Primary Key" section on page for additional information.)
Fast Refresh: Snapshot will be refreshed using the FAST refresh method (see "Refresh Types" on page for details).
Use a WHERE clause: Snapshot will contain a data subset of the target master table; this is helpful if you want to replicate only a range of data to the snapshot site. Press the Edit button to define the WHERE clause and see "Using a WHERE Clause" on page for detailed information.
Use a storage clause: Allows user to define custom storage settings for the generated snapshots. If enabled, you can modify the extents, space usage, and number of transaction settings. Press the Edit button to modify these settings and see "Using a Storage Clause" on page for detailed information.
Replication Manager will now add the selected objects to your snapshot group that you selected using the Edit Snapshot Group wizard.
To alter the definition of a replication object in a snapshot group, you should always use Replication Manager (or an equivalent API call). Use of Enterprise Manager or a SQL DDL command (for example, ALTER TABLE) to alter an object in a replicated environment can create inconsistencies.
You cannot alter the definition of nonsnapshot objects in a snapshot group. For more information about altering individual snapshots in a snapshot group, see "Altering a Snapshot".
To remove objects from a snapshot group:
Press the <SHIFT> key to select a range of objects or press the <CTRL> key to individually select multiple objects.
Press the button that meets your needs:
Note: When you drop an object from a snapshot group, Replication Manager automatically removes all corresponding system-generated objects that were necessary to support the object. |
If it ever becomes necessary to regenerate replication support, Replication Manager allows you to do this quickly and easily. To generate support for an updateable snapshot:
The snapshot property sheet will appear in the right pane of the Replication Manager user interface.
API Equivalent: DBMS_REPCAT.GENERATE_SNAPSHOT_SUPPORT
To delete a snapshot group:
API Equivalent: DBMS_REPCAT.DROP_SNAPSHOT_REPGROUP
A snapshot is a local copy of table data that originates from one or more remote master tables. Applications can query the data in a read-only table snapshot, but cannot insert, update, or delete rows in the snapshot. However, applications can query, insert, update, or delete the rows in an updateable snapshot.
Oracle's data replication facility supports independent table snapshots as well as snapshots that are part of a snapshot group. Consider the following issues when deciding whether to create a new snapshot as part of a snapshot group:
Replication Manager has many features that help you create and manage snapshots in an advanced replication environment. The following sections explain more about managing snapshots.
Before you create a new snapshot, make sure that the following preliminary tasks have been completed.
To create a read-only snapshot independent of a snapshot group:
If you don't see the target database, you may need to disconnect and relogin to the target database.
Edit Storage: Press the Edit Storage button to modify the storage characteristics of the index that will be created for your new snapshot. See "Using a Storage Clause" on page for more information.
Tablespace: Select the tablespace that will hold the generated index from the Tablespace pull-down list.
SELECT * FROM scott.emp WHERE empno = 7899
You do not need to enter a semi-colon at the end of your SELECT statement. To see the entire CREATE SNAPSHOT DDL, press the Show SQL button.
Your SELECT statement can be unfiltered, contain a simple WHERE clause, or contain several nested subqueries. For more information about subquery subsetting, see "Data Subsetting with Snapshots" on page .
The Row ID checkbox should only be enabled when interoperating with Oracle 7.3 and earlier databases. See "Snapshot Log" for more information.
The following sections explain how to alter an ungrouped snapshot in an advanced replication environment.
To edit a snapshot's storage settings:
The snapshot property sheet will appear in the right pane of the Replication Manager user interface.
Do not manipulate, modify, add to, or subtract from, the data in the base table of a snapshot. You can declare integrity constraints, such as referential or uniqueness constraints, for the base table of a snapshot. However, such constraints must be configured for deferred constraint checking.
You can also define PL/SQL triggers on the base table of a snapshot. However, such triggers must be coded so that they do not fire during snapshot refresh. Triggers that fire during snapshot refresh may generate unexpected results.
Additional Information: See "Triggers and Replication".
Never use Enterprise Manager or a SQL DDL command (for example, ALTER TABLE) to alter a snapshot definition. To alter the definition of a snapshot, drop the snapshot and then re-create it.
To remove a snapshot from a snapshot group:
Note: When you drop a snapshot from a snapshot group, Replication Manager automatically removes all corresponding system generated objects that were necessary to support the snapshot. |
To preserve referential integrity and transactional consistency among the snapshots of several related master tables, Oracle organizes and refreshes individual snapshots as part of a refresh group. After refreshing all of the snapshots in a refresh group, the data of all snapshots in the group corresponds to the same transactionally consistent point-in-time. Replication Manager has many features that help you create and manage refresh groups in a replication environment. The following sections explain more about managing refresh groups.
Additional Information: See "Refresh Groups" for more information about refresh groups.
To create a new refresh group for a snapshot site:
You can optionally press the Create Refresh Group button on the toolbar.
The Create Refresh Group property sheet has two pages: General, and Snapshots.
To add one or more snapshots to a refresh group:
Press the <SHIFT> key to select a range of snapshots or press the <CTRL> key to individually select multiple snapshots.
To remove one or more snapshots from a refresh group:
The refresh group property sheet will appear in the right pane of the Replication Manager user interface.
Press the <SHIFT> key to select a range of snapshots or press the <CTRL> key to individually select multiple snapshots.
To edit a snapshot group's refresh settings:
The refresh group property sheet will appear in the right pane of the Replication Manager user interface.
To force the immediate refresh of a refresh group:
The refresh group property sheet will appear in the right pane of the Replication Manager user interface.
To delete a refresh group:
The preceding sections of this chapter explained the most commonly performed administrative procedures that involve snapshot sites. For additional information on less commonly performed administrative procedures for snapshot sites, see "Advanced Management of Master and Snapshot Groups".
In addition to using Replication Manager to view information about an snapshot site in an advanced replication environment, you can also query the following data dictionary views:
At the Snapshot Site:
At the Master Site: