| Oracle® Database Advanced Replication Managemen
t API Reference 10g Release 1 (10.1) Part Number B10733-01 |
Home Contents Index
Master Index ![]() Feedback |
|
View PDF |
As your data delivery needs change due to growth, shrinkage, or emergencies, you are undoubtedly going to need to change the configuration of your replication environment. This chapter discusses managing the master sites of your replication environment. Specifically, this section describes altering and reconfiguring your master sites.
This chapter contains these topics:
Many replication administrative tasks can be performed only from the master definition site. Use th
e RELOCATE_MASTERDEF procedure in the DBMS_REPCAT package to move the master definition site to another mas
ter site. This API is especially useful when the master definition site becomes unavailable and you need to specify a new master defi
nition site (see "Option 2: The Old Master Definition Site Is Not Available").
Perform the actions in this se ction to change the master definition site if all master sites are available. Meet the following requirements to complete these actio ns:
Executed As: Replication Administrator
Executed At: Any Master Site
Replication Status: Running Normally (Not Quiesced)
Complete the following st eps:
CONNECT repadmin/repadmin@orc1.worlda>
BEGIN DBMS_REPCAT.RELOCATE_MASTERDEF ( gname => 'hr_repg', old_masterdef => 'orc1.world', new_masterdef => 'orc2.world', notify_masters => TRUE, include_old_masterdef => TRUE); END; /
Perform the actions in this section to change the master definition site if the old master definition site is
Executed As: Replication Administrator
Executed At: Any Master Site
Replication Status: Norma l
Complete the following steps:
CONNECT repadmin/repadmin@orc2.world
BEGIN DBMS_REPCAT.RELOCATE_MASTERDEF ( gname => 'hr_repg', old_masterde f => 'orc1.world', new_masterdef => 'orc2.world', notify_masters => TRUE , include_old_masterdef => FALSE); END; /
As your replication environment expands, you may need to add new master sites to a master group. You can either add new master sites to a master group that is running normally or to a master group that is quiesc ed. If the master group is not quiesced, then users can perform data manipulation language (DML) operations on the data while the new master sites are being added. However, more administrative actions are required when adding new master sites if the master group is not quiesced.
Follow the instructions in the appropriat e section to add new master sites to a master group:
This section contains procedures for adding new master sites to an existing master group that is not quiesced. These new sites may or may not already be replication sites (master sites or materialize d view sites) in other replication groups.
You can use one of the following methods when you are adding a new master site without quiescing the master group:
Use full database export/import and change-based recovery to add all of the replication groups at the master def inition site to the new master sites. When you use this method, the following conditions apply:
If your environment do es not meet all of these conditions, then you must use object-level export/import to add the new master sites. Figure 7-1 summarizes these conditions.
Text description of the illustration rarmanmb.gif
Use object-level export/import to add a master group to master sites that already have other replication gr oups or to add a master group to master sites that do not currently have any replication groups. This method can add one or more mast er groups to new master sites at a time, and you can choose a subset of the master groups at the master definition site to add to the new master sites during the operation.
If you use object-level export/import and there are i
ntegrity constraints that span more than one master group, then you must temporarily disable these integrity constraints on the table
being added to a new master site, if the other tables to which these constraints refer already exist at the new master site. Initial
ly, there are two rows in the DEFSCHEDULE data dictionary view that refer to the new master sites. When propagation is c
aught up, there is one row in this view, and when propagation from all the master sites to the new master site is caught up, you can
re-enable the integrity constraints you disabled.
Again, the two methods for adding new maste r sites without quiescing the master groups are the following:
When you use either method, propagation of deferred transactions to the new master site is partially or completely disabled while the new master sites are being added. Therefore, make sure each existing master site has en ough free space to store the largest unpropagated deferred transaction queue that you may encounter.
In addition, the following restrictions apply to both methods:
DBA_NEW_REPSITES data dictionary view at the master definition site, then the process is started and is not yet complete for
that master group.DBA_NEW_REPSITES data dictionary view, then the process is
started and is not yet complete for that master group.hq1.world is the master definition site for mgroup
1 and hq2.world is the master definition site for mgroup2, then you cannot add hq1.world to mgroup2 and hq2.world to mgroup1 at the same time.CO
MPATIBLE initialization parameter. If any master sites are lower than 9.0.1 compatibility level, then the master group must be
quiesced to extend it with new master sites. In this case, follow the instructions in "Adding New Maste
r Sites to a Quiesced Master Group".Also, before adding new master sites with either method, make sure you properly set up your new master sites for multimaster replication.
|
Note: If progress appears to stop during one of the pro cedures described in the following sections, then check your trace files and the alert log for messages. |
See Also:
|
Figure 7-2 show
s the major steps for using full database export/import or change-based recovery to add new master sites to a master group without qu
iescing. The following example script adds the new master sites orc4.world and orc5.world to the hr_r
epg master group. In this example, orc4.world is added using full database export/import and orc5.world is added using change-based recovery.
Text description of the illustration repma022.gif< /p>
Meet the following requirements to complete these actions:
Executed As: Replication Administrator, unless specified otherwise
Executed At:
Replication Status: Running N ormally (Not Quiesced)
Complete the following steps to use full database export/import or cha nge-based recovery to add sites to a master group.
/** *********************** BEGINNING OF SCRIPT ******************************
This step is not required if you are using change-based recovery.
| See Also:
Oracle Databas e Administrator's Guide for information about creating a database |
*/ SET ECHO ON SPOOL add_masters_full.out PAUSE Press <RETURN> when the databases for the new master sites are created. /*
Remember that you need to configure the following:
*/ PAUSE Press <RETURN> to cont inue the new master sites have been setup and the required scheduled links have been created. < /a>/*
See Also:
strong>
|
*/ CONNECT repadmin/repadmin@orc1.world /*
Before you begin, create the required schedul ed links between existing master sites and each new master site if they do not already exist.
See Also:
|
*/ BEGIN DBMS_REPCAT.SPECIFY_NEW_MASTERS ( gname => 'HR_REPG', master_list => 'orc4.world,orc5.world'); END; / /*
You can begin to track the extension process by qu erying the following data dictionary views in another SQL*Plus session:
*/ PAUSE Press <RETURN> when you have completed the these steps. /*
Before running the following procedure, ensure that there are an adequate number of background jobs running at eac h new master site. If you are using full database export/import, then make sure there is enough space in your rollback segments or un do tablespace for the export before you run this procedure.
See Also:
|
*/ VARIABLE masterdef_flashback_scn NUMB ER; VARIABLE extension_id VARCHAR2(32); BEGIN DBMS_REPCAT.ADD_NEW_MASTERS ( export_required => true, available_master _list => NULL, masterdef_flashback_scn => :masterdef_flashback_scn, exten sion_id => :extension_id, break_trans_to_masterdef => false, break_tran s_to_new_masters => false, percentage_for_catchup_mdef => 80, cycle _seconds_mdef => 60, percentage_for_catchup_new => 80, cycle_second s_new => 60); END; / /*The values for
masterdef_flashback_scnandextension_idare saved in to variables to be used later in the process. To see these values, you can query theDBA_REPSITES_NEWandDBA_REPE XTENSIONSdata dictionary views.*/ PAUSE Pre ss <RETURN> when you have completed the these steps. /*< a name="36415">If you need to undo the changes made to a particular master site by the
SPECIFY_NEW_MASTERS code> andADD_NEW_MASTERSprocedures, then use theDBMS_REPCAT.UNDO_ADD_NEW_MASTERS_REQUESTprocedure.For the
export_requiredparameter,trueis specified becauseorc4 .worldis being added using full database export/import. Althoughorc5.worldis using change-based recovery, thetruesetting is correct because at least one new master site is added using export/import.After successfully executing this procedure, monitor its progress by querying the
DBA_REPCATLOGdata dictiona ry view in another SQL*Plus session. Do not proceed to Step 7 until there is no remaining informatio n in this view about adding the new master sites. Assuming no extraneous information exists inDBA_REPCATLOGfrom other operations, you can enter the following statement:SELECT COUNT(*) FROM DBA_REPCATLOG;All of the processing is complete when this statement returns zero (0).
*/ PAUSE Press <RETURN> to continue when DBA_REPC ATLOG is empty. /*Step 6 If you are using full database export/import, then create a directory object at each database.
For master sites being added using change-based recovery, this step is not required and you can procee d to Step 8.
Each database involved in this operation must have a directory object to hold the Data Pump dump file, and the user who will perform the export or import must have
READandWRITEprivileges on this directory object. In this example, a Data Pump export is performed at the master definition site, and a Data Pump import is performed at each new master site.If you are using full database export/import, then, while connected in SQL*Plus to the a database as an administrative user who can create directory objects using the SQL statement
CREATEDIRECTORY, create a directory object to ho ld the Data Pump dump file and log files. For example:*/ CONNECT SYSTEM/MANAGER@orc1.world CREATE DIRECTORY DPUMP_DIR AS '/usr/dpump_dir'; CONNECT SYSTEM/MANAGER@orc4.world CREATE DIRECTORY DPUM P_DIR AS '/usr/dpump_dir'; CONNECT SYSTEM/MANAGER@orc5.world CREATE DIRECTORY DPUMP_DIR AS '/usr/dpump_dir'; /*In this example,
SYSTEMuser performs all exports and imports. If a user other than the user who created the directory object will perform the export or import, then grant this userREADandWRITE privileges on the directory object.Make sure you complete these actions at each database involved in the operation.
Step 7 Perform the fol lowing substeps for the master sites being added using full database export/import.
F or master sites being added using change-based recovery, these substeps are not required and you can proceed to Step 8.
Perform full database export of the mast er definition database. Use the system change number (SCN) returned by the
masterdef_flashback_scnparameter in Step 5 for theFLASHBACK_SCNexport parameter.You can query the
DBA_REPEXTENSIONSdata dictionary view for theFLASHBACK_SCNvalue:SELECT FLASHBACK_SCN FROM DBA_REPEXTENSIONS;In this exam ple, assume that the value returned by this query is
124723.In this example,
orc4.world is using full database export/import. Therefore, perform the full database export of the master definition data base so that it can be imported into orc4.worldduring a later step. However, theorc5.worlddatabase is us ing change-based recovery. Therefore, the export would not be required if you were adding onlyorc5.world.On a command line, perform the export. This example connects as the
SYSTEMuser. The followin g is an example Data Pump export command:expdp system/manager FULL=y DIRECTORY=DPUMP_DIR DUM PFILE=fulldb_orc1.dmp FLASHBACK_SCN=124723Consider the following wh en you run the Export utility:
DBA role or the EXP_FULL_DATABASE role can export in full database mode.UNDO_RETENTION initialization parameter is set correctly before performing the export.CONSISTENT export pa
rameter. This parameter does not apply to Data Pump.
|
*/ < a name="24224"> PAUSE Press <RETURN> to continue when the export is complete. /*
Resume propagation to the master definition site.< /p>
Running the following procedure indicates that export is effectively finished and propagation can be enabled for both extended and unaffected master groups at the master sites.
*/ BEGIN DBMS_REPCAT.RESUME_PROPAGATION_TO_MDEF ( a> extension_id => :extension_id); END; / < a name="31371">/*
You can find the extension_id by q
uerying the DBA_REPSITES_NEW data dictionary view.
Transfer the export dump file to the new master sites.
Using the DBMS_FILE_TRANSFER package, FTP, or some oth
er method, transfer the export dump file to the other new master sites that are being added with full database export/import. You wil
l need this export dump file at each new site to perform the import described in the next step.
< /a>*/ PAUSE Press <RETURN> to continue after transferring the dump file. /*
Set the JOB_QUEUE_PROCESSES initialization parameter to zero for each new master site.
*/ PAUSE Press <RETURN> to continue after JOB_QUEUE_PROCESSES is set to zero at each new master site. /*
Perform the import. This example connects as the
SYSTEM user to perform the import at orc4.world. The following is an example import command:
impdp system/manager FULL=y DIRECTORY=DPUMP_DIR DUMPFILE=fulldb_orc1.dmp
Only users with the DBA role or the IMP_FULL_DATABASE role can import in full dat
abase mode.
| See Also:
Oracle Database Utilities for information about performing a Data Pump import |
*/ PAUSE Press <RETURN> to continue when the import is complete. /*
masterdef_flashback_scn parameter in Step 5. You
can query the DBA_REPEXTENSIONS data dictionary view for the masterdef_flashback_scn value.
You can perform a change-based recovery in one of the following ways:
RECOVER command. See the Oracle Database Backup and Recovery Advanced User's Guide for instructions.DUPLICATE command. See the Oracle Database Backup and Recovery Adv
anced User's Guide for instructions.Connect to the site where you will perfo rm the change-based recovery:
*/ CONNECT repadmin/repadmin@orc5.world PAUSE Press <RETURN> to continue whe n the change-based recovery is complete. You can use a separate terminal window to perform the change-based recovery. /*
hr.SPECIFY_NEW_MASTERS procedure that you ran in Step 4. You
can query the DBLINK column in the DBA_REPSITES_NEW data dictionary view to see the global name for each ne
w master site.
You can set the global name using the ALTER DATABASE statement, as in the following example:
ALTER DATABASE RENAME GLOBAL_NAME TO orc4.world ;
| See Also:
"Creating Scheduled Links Between the Master Sites" for information |
*/ PAUSE Pre ss <RETURN> when you have completed the these steps. /*< h5 class="LST">Step 10 Allow new masters to receive deferred transactions.
The following procedure enables the propagation of deferred transactions from other prepared new mast er sites and existing master sites to the invocation master site. This procedure also enables the propagation of deferred transaction s from the invocation master site to the other new master sites and existing master sites.
*/ CONNECT repadm in/repadmin@orc4.world BEGIN DBMS_REPCAT.P REPARE_INSTANTIATED_MASTER ( extension_id => :extension_id); END; / CONNECT repadmin/repadmin@orc5.world BEGIN DBMS_REPCAT.PREPARE_INSTANTIATED_MASTER ( extension_ id => :extension_id); END; / SET ECHO OFF SPOOL OFF /*
|
Note: You can
find the |
************************** END OF SCRIPT **********************************/
Figure 7-3 shows the major
steps for using object-level export/import to add new master sites to a master group without quiescing. The following example proced
ure adds the new master sites orc4.world and orc5.world to the hr_repg master group. An object
-level export/import involves exporting and importing the tables in a master group. When you export and import the tables, other depe
ndent database objects, such as indexes, are exported and imported as well.
If you have an in tegrity constraint that spans two master groups, then you have a child table in one master group (the child master group) and a paren t table in a different master group (the parent master group). In this case, Oracle Corporation recommends that you add new master si tes to both master groups at the same time. However, if you cannot do this, then you must quiesce the child master group before addin g new master sites to it. Here, the child table includes a foreign key, which makes it dependent on the values in the parent table. I f you do not quiesce the child master group, then conflicts may result when you add master sites to it. You can still add master site s to the parent master group without quiescing it.
Text description of the illustration repma023.gif
Meet the following requirements to complete these actions:
Executed As: Replication Administrator, unless specified otherwise
Executed At:
Replication Status: Running Normally (Not Quiesced)
Complete the following steps to use object-level export/ import to add sites to a master group.
/************** *********** BEGINNING OF SCRIPT ******************************
In this example, the replicated schema is hr. This schema probably already exist
at the new master sites because it is a sample schema that is installed when you install Oracle.
Oracle Database Sample Schemas for general information about the sample schemas and for information about installing them |
* / SET ECHO ON SPOOL add_masters_object.out PAUSE Press <RETURN> to continue when the users are created at the new master sites. /*
Failure to precreate these tables will result in errors later in the procedure. If there are no cir cular dependencies, then this step is not required, and you can proceed to Step 3.
Some of the tables in the hr schema contain circular dependencies. Therefore, in this example, th
e tables in the hr schema must be precreated at each new master site. Again, the hr schema tables are typic
ally created during Oracle installation and so may already exist at the new master sites.
If
you need to precreate tables, then disable referential integrity constraints for these tables at the new master sites before the impo
rt. Referential integrity constraints can cause errors when you import data into existing tables. This example disables the referenti
al integrity constraints for the precreated tables in the hr schema at the new master sites.
hr schema at the new master sites to ensure that they do not contain any data.
|
*/ PAUSE Press <RETURN> to continue when the tables are precreated at the new master sites, if table precreatio n is required. After the tables are precreated, the following statements disable the referential integrity constraints related to t he hr schema and truncate the tables in the hr schema at the new site. CONNECT oe/oe@orc4.wo rld ALTER TABLE oe.warehouses DISABLE CONSTRAINT warehouses_location_ fk; ALTER TABLE oe.customers DISABLE CONSTRAINT customers_account_man ager_fk; ALTER TABLE oe.orders DISABLE CONSTRAINT orders_sales_rep_fk ; CONNECT hr/hr@orc4.world ALTER TABLE hr.countries DISABLE CONSTRAINT countr_reg_fk; ALTER TABLE hr.departments DISABLE CONSTRAINT dept_mgr_fk DISABLE CONSTRAINT dept_loc_fk; ALTER TABLE hr.employees DISABLE CONSTRAINT emp_dept_fk DISABLE CONSTRAINT emp_j ob_fk DISABLE CONSTRAINT emp_manager_fk; ALTER TABLE hr.job_history DISABLE CONSTRAINT jhist_job_fk DISABLE CONSTRAINT jhist_emp_fk DISAB LE CONSTRAINT jhist_dept_fk; ALTER TABLE hr.locations DISABLE CONSTRA INT loc_c_id_fk; TRUNCATE TABLE hr.countries; TRUNCATE TABLE hr.departme nts; TRUNCATE TABLE hr.employees; TRUNCATE TABLE hr.jobs; TRUNCATE TABLE hr.job_history; TRUNCATE TABLE hr.locations; TRUNCATE TABLE hr.regions; CONNECT oe/oe@orc5.world ALTER TABLE oe.warehouses DISABLE CONSTRAINT warehouses_location_fk; ALTER TABLE oe.customers DISABLE CONSTRAINT customers_account_manager_fk; ALTER TABLE oe.orders DISABLE CONSTRAINT orders_sales_rep_fk; CONNECT hr/hr@orc5.world ALTER TABLE hr.countries DISABLE CONSTRAINT countr_reg_fk; ALTER TABLE hr.departments DISABLE CONSTRAINT dept_mgr_fk DISABLE CONSTRAINT dept _loc_fk; ALTER TABLE hr.employees DISABLE CONSTRAINT emp_dept_fk DISABLE CONSTRAINT emp_job_fk DISABLE CONSTRAINT emp_manager_fk; ALTER TABLE hr.job_history DISABLE CONSTRAINT jhist_job_fk DISABLE CONSTRAINT jhist_emp_fk DISABLE CONSTRAINT jhist_dept_fk; ALTER TABLE hr.locatio ns DISABLE CONSTRAINT loc_c_id_fk; TRUNCATE TABLE hr.countries; TRUNCATE TABLE hr.departments; TRUNCATE TABLE hr.employees; TRUNCATE TABLE hr. jobs; TRUNCATE TABLE hr.job_history; TRUNCATE TABLE hr.locations; TRUNCAT E TABLE hr.regions; /*
Remember that you need to configure the following:
*/ PAU SE Press <RETURN> to continue the new master sites have been setup and the required scheduled links have been created. /*
See Also:
|
*/ CONNECT repadmin/repadmin@orc1.world /*
*/ BEGIN DBMS_REPCAT.SPECIFY_NEW_MASTERS ( gna me => 'hr_repg', master_list => 'orc4.world,orc5.world'); END; a>/ /*
You can begin to trac k the extension process by querying the following data dictionary views in another SQL*Plus session:
Before running the following procedure, ensure that there are an adequate number of background jobs running at each new master site. Also, make sure there is enough space in your rollback segments or undo tablespace for the export before you run this procedure.
See Also:
|
*/ VARIABLE masterdef_flashback_scn NUMBER; VARIABLE extension_id VARCHAR2(32); BEGIN DBMS_REPCAT.ADD_NEW_MASTERS ( export_required => true, available_master_list => 'orc4.world,orc5.world', masterdef_flashback_scn => :masterdef_ flashback_scn, extension_id => :extension_id, break_trans_to_masterdef => false, break_trans_to_new_masters => false, percentage_for_catchup_mde f => 80, cycle_seconds_mdef => 60, percentage_for_catchup_new => 80, cycle_seconds_new => 60); END; / < a name="31829">/*
The sites specified for the available_mas
ter_list parameter must be same as the sites specified in the SPECIFY_NEW_MASTERS procedure in Step 5.
The values for masterdef_flashback_scn and extensio
n_id are saved into variables to be used later in the process. To see these values, you can also query the DBA_REPSITES_
NEW and DBA_REPEXTENSIONS data dictionary views.
If you need to undo the
changes made to a particular master site by the SPECIFY_NEW_MASTERS and ADD_NEW_MASTERS procedures, then us
e the UNDO_ADD_NEW_MASTERS_REQUEST procedure.
After successfully executing this
procedure, monitor its progress by querying the DBA_REPCATLOG data dictionary view in another SQL*Plus session. Do not p
roceed to Step 8 until there is no remaining information in this view about adding the new master si
tes. Assuming there is no extraneous information in DBA_REPCATLOG from other operations, you can enter the following sta
tement:
SELECT COUNT(*) FROM DBA_REPCATLOG;
All of the processing is complete when this statement returns zero (0).
*/ PAUSE Press <RETURN> to continue when DBA_REPCATLOG is empty. /*
Each database involved in this operation must have a directory
object to hold the Data Pump dump file, and the user who will perform the export or import must have READ and WRIT
E privileges on this directory object. In this example, a Data Pump export is performed at the master definition site, and a D
ata Pump import is performed at each new master site.
While connected in SQL*Plus to the a da
tabase as an administrative user who can create directory objects using the SQL statement CREATE DIRECTORY,
create a directory object to hold the Data Pump dump file and log files. For example:
*/ CONNECT SYSTEM/MANAGER@orc1.world CREATE DIRECTORY DPU MP_DIR AS '/usr/dpump_dir'; CONNECT SYSTEM/MANAGER@orc4.world CREATE DIRECTORY DPUMP_DIR AS '/usr/dpump_dir'; CONNECT SYSTEM/MANAGER@orc5.world CREATE DIRECTORY DPUMP_DIR AS '/usr/dpump_dir'; /*
In this example, SYSTEM user performs all exports and i
mports. If a user other than the user who created the directory object will perform the export or import, then grant this user
READ and WRITE privileges on the directory object.
Make sure you complete these actions at each database involved in the operation.
At the master definition database, perform an object-level export for each master table in the master groups that will be created at the new master sites. An object-level export includes exports performed in table mode, user mode, or tablespace mode.
Use the system change number (SCN) returned by the masterdef_flashback_scn parameter in Ste
p 6 for the FLASHBACK_SCN export parameter. You can query the DBA_REPEXTENSIONS
code> data dictionary view for the FLASHBACK_SCN value:
SELECT FLASHBACK_SCN FRO M DBA_REPEXTENSIONS;
In this example, assume that the SCN value is < code>3456871.
On a command line, perform the export. This example connects as the
expdp system/mana ger TABLES=HR.COUNTRIES,HR.DEPARTMENTS,HR.EMPLOYEES,HR.JOB_ HISTORY,HR.JOBS,HR.LOCATIONS,HR.REGIONS DIRECTORY=DPUMP_DIR DUMPFILE=hr_ tables.dmp CONTENT=data_only FLASHBACK_SCN=3456871
The CONTENT<
/code> parameter is used in this example because the tables already exist at the import sites. You may not need to specify this param
eter.
Consider the following when you run perform the export:
UNDO_RETENTION initialization parameter is set correctly before perf
orming the export.See Also:
|
*/ PAUSE Press <RET URN> to continue when the export is complete. /*
Running the following procedure indicates that export is effectively finished and propagation can be enabled for b oth extended and unaffected master groups at the master sites.
*/ CONNECT repadmin/repadmin@orc1.world BEGIN DBMS_REPCAT.RESUME_PROPAGATION_TO_MDEF ( extension_id => :extension_id); END; / /*
You can find the extension_id by querying the DBA_REPSITES_NEW data dictionary view.
Using the DBMS_FILE_TRANSFER package, FTP, or some other method, tran
sfer the export dump files to the other new master sites that are being added with object-level export/import. You will need these ex
port dump files at each new site to perform the import described in the next step.
*/ PAUSE Press <RETURN> to continue when the export dump files have been tra nsfered to the new master sites that are being added with object-level export/import. /*
On a command line, perform the import. This example connects as the SYSTEM user. The following is an
example import command:
impdp system/manager TABLES=HR.COUNTRIES,HR.DEPARTMENTS,HR.EMPLOYEES, HR.JOB_ HISTORY,HR.JOBS,HR.LOCATIONS,HR.REGIONS DIRECTORY=DPUMP_DIR DUMPFILE=hr_ tables.dmp CONTENT=data_only TABLE_EXISTS_ACTION=app end
Other objects, such as the indexes based on the tables, are impor
ted automatically. The CONTENT and TABLE_EXISTS_ACTION parameters are used in this example because the tabl
es already exist at the import sites. You may not need to specify these parameters.
Oracle Database Utilities for information about p erforming a Data Pump import
Perform the object-level imports at each site:
*/ PAUSE Press <RETURN> to continue whe n the imports are complete at each site. You can use a separate terminal window to perform the object-level imports. /*
The following procedure enables the propag ation of deferred transactions from other prepared new master sites and existing master sites to the invocation master site. This pro cedure also enables the propagation of deferred transactions from the invocation master site to the other new master sites and existi ng master sites.
*/ CONN ECT repadmin/repadmin@orc4.world BEGIN DBM S_REPCAT.PREPARE_INSTANTIATED_MASTER ( extension_id => :extension_id); END; / CONNECT repadmin/repadmin@orc5.world BEGIN DBMS_REPCAT.PREPARE_INSTANTIATED_MASTER ( extension_id => :extension_id); END; / SET ECHO OFF SPOOL OFF /*
************************** END OF SCRIPT **********************************/
You can add new master sites to a quiesced master group i n one of the following ways:
T
ypically, you should only use the ADD_MASTER_DATABASE procedure if you have a relatively small master group or if you pl
an to precreate the replication tables and load the data into them at the new master sites. If this is not the case, the ADD_MA
STER_DATABASE procedure may not be a good option because the entire master group is copied over the network. For larger master
groups, either precreate the objects in the master group at the new master sites or use offline instantiation.
You can use the ADD_MASTER_DATABAS
E procedure to add additional master sites to an existing master group that is quiesced. Executing this procedure replicates e
xisting master objects to the new site. If any master site is lower than 9.0.1 compatibility level, then you must use the following p
rocedure. That is, the master group must be quiesced to extend it with new master sites. You control the compatibility level of a dat
abase with the COMPATIBLE initialization parameter.
Meet the following requireme nts to complete these actions:
Executed As: Replication Adminis trator
Executed At: Master Definition Site
Replication Status: Quiesced
Complete the f
ollowing steps to use the ADD_MASTER_DATABASE procedure to add sites to a master group.
|
Note: If you are viewing t his document online, then you can copy the text from the "BEGINNING OF SCRIPT" line after this note to the "END OF SCRIPT" line into a text editor and then edit the text to create a script for your environment. |
|
See Also:
Oracle Database Utilities fo r information about performing a Data Pump export |
*/ PAUSE Press <RETURN> to continue when the export is complete. /*
Because it may take some time to complete the offline instantiation process, you ca
n resume replication activity for the remaining master sites (excluding the new master site) by executing the RESUME_SUBSET_OF_
MASTERS procedure in the DBMS_OFFLINE_OG package after the export is complete. In the following example, replicat
ion activity is resumed at all master sites except the new master site -- orc4.world.
*/ CONNECT repadmin/repadmin@orc1.world BEGIN DBMS_OFFLINE_OG.RESUME_SUBSET_OF_MASTERS ( gname => ; 'hr_repg', new_site => 'orc4.world'); END; / < /a> /*
Using the DBMS_FILE_TRANSFER
package, FTP, or some other method, transfer the export dump file to the new master site. You will need this export dump file at the
new site to perform the import described in the next step.
*/ PAUSE Press <RETURN> to continue when the export dump file has been transfered to the new master site. /*
*/ CONNECT repadmin/repadmin@orc4.world /*
You must prepare the new site to import the data in your export file. Make sure you execute the following proc edure at the new master site.
*/ BEGIN DBMS_OFFLINE_OG.BEGIN_LOAD ( gname => 'hr_repg', new_site => 'orc4.world'); END; / /* < /pre>Step 12 In a separate terminal window, import d ata from export dump file.
On a command line, perform the import. This example connec ts as the
SYSTEMuser. The following is an example import command:impdp system/ manager SCHEMAS=hr DIRECTORY=DPUMP_DIR DUMPFILE=hr_schema.dmpOther o bjects, such as the indexes based on the tables, are imported automatically.
See Also: Oracle Database Utilities for information about performi ng a Data Pump import
*/ PAU SE Press <RETURN> to continue when the import is complete. /*Step 13 Complete the load process at new master site.
After importing the export file, you are ready to complete the offline instantiation process at the n ew master site. Executing the
DBMS_OFFLINE_OG.END_LOADprocedure prepares the new site for normal replication activity.< /p>*/ BEGIN DBMS_OFFLINE_OG.END_LOAD ( gname => 'hr_repg', new_site => 'orc4. world'); END; / /*Step 14 Connect to the master definition site as the replication administrator.
*/ CONNECT repadmin/repadmin@orc1.world /*Step 15 Complete instantiation process.
After completing the steps at the new master site, you are ready to complete the offline instantiation process. Executing the
END_INSTANTIATIONprocedure in theDBM S_OFFLINE_OGpackage completes the process and resumes normal replication activity at all master sites. Make sure you execute the following procedure at the master definition site.*/ BEGIN DBMS_OFFLINE_OG.END_INSTANTIATION ( gname => 'hr_repg', new_site => 'orc4.world'); END; / SET ECHO OFF SPOOL OFF /************************* END OF SCRIPT **********************************/Removing a Master Site from a Master Group
When it becomes necessary to remove a master site from a master group, use the
REMOVE_M ASTER_DATABASESprocedure to drop one or more master sites.Meet the following require ments to complete these actions:
Executed As: Replication Admin istrator
Executed At: Master Definition Site
Replication Status: Quiesced
Complete the following steps to remove a master site.
/*********** ************** BEGINNING OF SCRIPT ******************************Step 1 Connect to the master definition site as the replication administrator.
*/ SET ECHO ON SPOOL remove_masters.o ut CONNECT repadmin/repadmin@orc1.world /*Step 2 If the replication status is normal for the mas ter group, then change the status to quiesced.
*/ BEGIN DBMS_REPCAT.SUSPEND_MASTER_ACTIVITY ( gnam e => 'hr_repg'); END; / /*Step 3 Remove the master site.
*/ BEGIN DBMS_REPCAT.REMOVE_MAST ER_DATABASES ( gname => 'hr_repg', master_list => 'orc4.world'); END; / /*You should wait until the
DBA_REPCATLOGview is empty. Execute the followingSELECTstateme nt in another SQL*Plus session to monitor theDBA_REPCATLOGview:SELECT * FROM DBA_REPCATLOG WHERE GNAME = 'HR_REPG'; */ PAUSE Pre ss <RETURN> to continue when DBA_REPCATLOG is empty for the master group. /*Step 4 Resume master activity for the master group.
*/ BEGIN DBMS_REPCAT.RESUME_MASTER_ACTIVITY ( gname => 'hr_repg'); END; / SET ECHO OFF SPOOL OFF /************************* END OF SCRIPT **********************************/a>Removing an Unavailable Master Site< /font>
The sites being removed from a master group do not have to be accessib le. When a master site will not be available for an extended period of time due to a system or network failure, you might decide to d rop the master site from the master group.
However, because the site is unavailable, you most likely cannot suspend replication activity for the master group. You can use the
REMOVE_MASTER_DATABASESprocedure in t heDBMS_REPCATpackage to remove master sites from a master group, even if the master group is not quiesced.If this is the case, you are responsible for:
Specifically, the next time that you suspend replication activity for a master gro up, you must complete the following steps as soon as possible after the unavailable master sites are removed:
See "SUSPEND_MASTER_ACTIVITY Procedure" for information.
See "DELETE_TRAN Procedure" for information.< /p>
See "DELETE_TRAN Procedure" for information.
See "Managing the Error Queue" for information about reexecuting error trans actions, and see "DELETE_TRAN Procedure" for information about remo ving error transactions.
If you cannot remove one
or more deferred transactions from a remaining master, execute the DBMS_DEFER_SYS.DELETE_TRAN procedure at the master s
ite.
See Chapter 16, "DBMS_RECTIFIER_DIFF" for information about determining and correcting differences.
See "RESUME_MASTER_ACTIVITY Procedure" for information.
|
Note: After droppin g an unavailable master site from a master group, you should also remove the master group from the dropped site to finish the cleanup . |
Several procedures in the DBMS_REPCAT package enable you to update the comment information in the various data diction
ary views associated with replication. Table 7-1 lists the appropriate procedure to call for ea
ch view.
| View | DBMS_REPCAT Procedure | See for Parameter Information | tr>||||||||
|---|---|---|---|---|---|---|---|---|---|---|
DBA_REPGRO UP |
COMMENT_ON_REPGROUP( gname IN VARCHAR2, comment IN VARCHAR2) |
|||||||||
DBA_REPOBJECT |
COMMENT_ON_REPOBJECT( sname IN VARCHAR2, oname IN VARCH AR2, type IN VARCHAR2, comment IN VARCHAR2) |
|||||||||
DBA_RE PSITES |
COMMENT_ON_REPSITES( gname IN VARCHAR2, master IN VARCHAR, comment IN VARCHAR2) |
<
td class="Formal">
|||||||||
< /a>DBA_REPCOLUMN_GROUP |
COMMENT_ON_COLUMN_GROUP( sname IN VARCHAR2, oname IN VARCHAR2, column_group IN VAR CHAR2, comment IN VARCHAR2) |
|||||||||
DBA_REPPRIORITY_GROUP |
COMMENT_ON_PRIORITY_GROUP( gname IN VARCHAR2, pgroup IN VARCHAR2) comment IN VARCHAR2) |
|||||||||
DBA_REPPRIORITY_GROUP (site priority group) |
COMMENT_ON_SITE_PR IORITY( gname IN VARCHAR2, name IN VARCHAR2, comment IN VARCHAR2) |
|||||||||
|
|
The parameters
for the | |||||||||
DBA_REPRESOLUTION (update conflicts) |
COMMENT_ON_UPDATE_RESOLUTION( sname IN VARCHAR2, oname IN VARCHAR2, column_group IN VARCHAR2, sequence_no IN NUMBER, comment IN VARCHAR2) |
The parameters for the | ||||||||
DBA_REPRESOLUTION (delete conflicts) |
a>COMMENT_ON_DELETE_RESOLUTION( sname IN VARCHAR2, oname IN VARCHAR2, sequence_no IN NUMBER, comment IN VARCHAR2) |
The parameters for the |
| See Also:
Oracle Database Advanced Replication for more information about type agreement at replication sites |
Serial execution ensures that your data remains consistent. The replication facility propagates and executes repli cated transactions one at a time. For example, assume that you have two procedures, A and B, that perform updates on local data. Now assume that you perform the following actions, in order:
The replicas of A and B o n the other nodes are executed completely serially, in the same order that they were committed at the originating site. If A and B execute concu rrently at the originating site, however, then they may produce different results locally than they do remotely. Executing A and B se rially at the originating site ensures that all sites have identical results. Propagating the transaction serially ensures that A and B are executing in serial order at the target site in all cases.
Alternatively, you could wr
ite the procedures carefully, to ensure serialization. For example, you could use SELECT... FOR UPDAT
E for queries to ensure serialization at the originating site and at the target site if you are using parallel propagation.
You must disable row-level replication s upport at the start of your procedure, and then re-enable support at the end. This operation ensures that any updates that occur as a result of executing the procedure are not propagated to other sites. Row-level replication is enabled and disabled by calling the fo llowing procedures, respectively:
When you generate replic ation support for your replicated package, Oracle creates a wrapper package in the schema of the replication propagator.
The wrapper package has the same name as the original package, but its name is prefixed wi
th the string you supply when you generate replication support for the procedure. If you do not supply a prefix, then Oracle uses the
default prefix, defer_. The wrapper procedure has the same parameters as the original, along with two additional parame
ters: call_local and call_remote. These two CHAR parameters determine where the procedure is e
xecuted. When call_local is 'Y', the procedure is executed locally. When call_remote is
'Y', the procedure will ultimately be executed at all other master sites in the replication environment.
The remote procedures are called directly if you are propagating changes synchronously, or calls to these procedur
es are added to the deferred transaction queue if you are propagating changes asynchronously. By default, call_local is
'N', and call_remote is 'Y'.
Oracle generates replicat ion support for a package in two phases. The first phase creates the package specification at all sites. Phase two generates the pack age body at all sites. These two phases are necessary to support synchronous replication.
For
example, suppose you create the package emp_mgmt containing the procedure new_dept, which takes one argume
nt, email. To replicate this package to all master sites in your system, you can use the Replication Management tool to
add the package to a master group and then generate replication support for the object. After completing these steps, an application
can call procedure in the replicated package as follows:
BEGIN defer_emp_ mgmt.new_dept( email => 'jones', call_local => 'Y', call_remote => 'Y'); END; /
The Replicat ion Management tool's online help for more information about managing master groups and replicated objects using the Replication Mana gement tool |
If you ar e operating in a mixed replication environment with static partitioning of data ownership (that is, if you are not preventing row-lev el replication), then Advanced Replication preserves the order of operations at the remote node, because both row-level and procedura l replication use the same asynchronous queue.
Text description of the illustration repma008.gif
|
![]() Copyright © 1996, 2003 Oracle Corporation All Rights Reserved. |
|