Oracle7 Server Distributed Systems Volume II: Replicated Data
Adding a Master Site
To add another master site to your replicated environment, call the ADD_MASTER_DATABASE procedure in the DBMS_REPCAT package, as shown in the following example:
DBMS_REPCAT.ADD_MASTER_DATABASE(
gname => 'acct',
master => 'acct_ny.ny.com',
use_existing_objects => TRUE,
copy_rows => TRUE,
comment => 'master site added by `||user||
' on `||sysdate,
propagation_mode => 'asynchronous');
In this example, the ACCT_NY database is added as a new master replication site for the ACCT replicated object group. This site will propagate changes to all other existing sites asynchronously, and all existing sites will asynchronously propagate changes to this site. For information on selecting a propagation mode, refer to .
You must call ADD_MASTER_DATABASE at the master definition site. The replication catalog views at the new master site are updated with the information necessary to create the replicated object group. The replicated object group at the new master site is populated asynchronously as described .
The replicated objects are created in the replicated object group as described in "Replicating the Object at Each Master Site" .
Note: Oracle attempts to create the objects in dependency order. If you have circular dependencies between objects, you may need to precreate and populate these objects at the new master site in order for this procedure to complete successfully.
Note: If a table has a foreign key constraint that references columns in the table, you may need to precreate and populate the table at the new master site.
Additional Information: The parameters for the ADD_MASTER_DATABASE procedure are described in Table 12 - 64, and the exceptions are listed in Table 12 - 65.
Adding a Site to an Existing Replicated Environment
If you are adding a new master site to an existing replicated environment (one in which replication activity has already occurred), you must perform the following steps:
- Make sure that you have the necessary links and privileges for the new site as described . You must create links from this site to all existing sites, and from all existing sites to this site.
- Suspend all replication activity for the replicated object group by calling DBMS_REPCAT.SUSPEND_MASTER_ACTIVITY at the master definition site, as described .
- Add the new master site by calling ADD_MASTER_DATABASE as described above. When you add a site to an existing replicated environment, Oracle recreates all of the generated triggers and their associated packages at all existing master sites. This is necessary to ensure that DML changes at these existing sites are propagated to the new site using the appropriate method.
Warning: Do not resume replication activity or do additional DBMS_REPCAT.* administration for the replicated object group until the new master site appears in the RepSite view at the master definition site. Any changes that you make at any site will not be propagated to the new site until it is included in the RepSite view and you may not be able to resynchronize your data.
- If your new master database site will be propagating changes asynchronously, you must also schedule propagation of changes between the new master site and existing master sites, as described . Additionally, if any existing sites will be asynchronously propagating changes to this site, you must be certain that you have scheduled execution of the deferred transaction queue at those sites as well.
- After creating a new master site you must resume replication activity by calling DBMS_REPCAT.RESUME_MASTER_ACTIVITY at the master definition site.
Adding a Site to an Existing Replicated Environment Using Offline Instantiation
Offline instantiation of a master site allows you to create a new master site while limiting the time required for existing sites in your replicated system to be quiesced. It is primarily useful for those sites with very large databases where the time required to transfer the data through network links to the new site would be prohibitive.
Offline instantiation requires only that your existing master sites be quiesced long enough to do an export of the database objects to tape from the master site being used as the source. You can then unquiesce the sites, transport the tape to the new site, import the export file, then bring the new site online.
The following are the steps necessary to instantiate a new site:
- Make sure that you have the necessary links and privileges for the new site as described . You must create links from this site to all existing sites, and from all existing sites to this site.
- Suspend all replication activity for the replicated object group by calling DBMS_REPCAT.SUSPEND_MASTER_ACTIVITY at the master definition site, as described .
Warning: Do not resume replication activity or do additional DBMS_REPCAT.* administration for the replicated object group until the new master site appears in the RepSite view at the master definition site. Any changes that you make at any site will not be propagated to the new site until it is included in the RepSite view and you may not be able to resynchronize your data.
- From the master definition site, call the procedure DBMS_OFFLINE_OG.BEGIN_INSTANTIATION (gname, new_site). This procedure will add the specified new_site to the replicated object group, gname.
- Export the user-defined tables for each schema making up the object group, gname. This can be done from any master site. Note that, if your object group consists of more than one schema, you will need to export the user-defined tables for each schema. For more information about using the Export utility, see and Oracle7 Server Utilities.
- From the master definition site, call the procedure DBMS_OFFLINE_OG.RESUME_SUBSET_OF_MASTERS (gname, new_site). At this point, normal, non-administrative activities can resume at the existing master sites. The new site, however, will remain quiesced.
Therefore, propagation of job queues to the new site is disabled, but the jobs will remain in the queue for later propagation when the new site is unquiesced.
- At this point, the tape holding the export file can be transferred to the new site.
- After the tape is available at the new site, from the new master site, call DBMS_OFFLINE_OG.BEGIN_LOAD (gname, new_site). This procedure disables triggers at the new site so that no updates can be made while you import your data. The procedure also disables propagation of the job queue from the new site to the master sites.
- Use the Import utility to import the data from tape. For more information about using the Import utility, see and Oracle7 Server Utilities.
- When the import is completed, reenable the new site's triggers and job queue propagation by calling DBMS_OFFLINE_OG.END_LOAD (gname, new_site).
- Return to the master definition site and call the procedure DBMS_OFFLINE_OG.END_INSTANTIATION (gname, new_site). This procedure resumes propagation to the new site.
Notes:
- If you will be creating multiple new sites, you must perform the above steps for each new site. New sites cannot be instantiated as a group.
- Be careful to call the listed procedures from the appropriate site. Failure to do so could cause unexpected and unwanted results.
- If you need to reenable queue propagation manually, use the procedure DBMS_DEFER_SYS.SET_DISABLED(). See for more information.
- The propagation method used for offline instantiation is asynchronous.