Home | Previous Page | Next Page   Appendix A. Command-Line Utility Reference >

cdr define replicate

The cdr define replicate command defines a replicate in the global catalog.

Syntax

Read syntax diagramSkip visual syntax diagram>>-cdr define replicate--+-------------------------+------------>
                         |                    (1)  |
                         '-| Connect Option |------'
 
>--+-----------------------------------+------------------------>
   |                              (2)  |
   '-| Master Replicate Options |------'
 
                        (3)
>--| Conflict Options |-------+------------------------+-------->
                              |                   (4)  |
                              '-| Scope Options |------'
 
>--+----------------------------+------------------------------->
   |                       (5)  |
   '-| Frequency Options |------'
 
>--+--------------------------+--------------------------------->
   |                     (6)  |
   '-| Special Options |------'
 
>--+-replicate-------------------------+------------------------>
   |                              (7)  |
   '-| Shadow Replicate Options |------'
 
   .---------------------------.
   V                           |
>----+-----------------------+-+-------------------------------><
     '-participant--modifier-'
 
Notes:
  1. See page Connect Option.
  2. See page Master Replicate Options.
  3. See page Conflict Options.
  4. See page Scope Options.
  5. See page Frequency Options.
  6. See page Special Options.
  7. See page Shadow Replicate Options.
Element Purpose Restrictions Syntax
modifier Specifies the rows and columns to replicate Participant Modifier
participant Name of a participant in the replication The participant must exist. Participant
replicate Name of the new replicate The replicate name must be unique. Long Identifiers

Usage

To be useful, a replicate must include at least two participants. You can define a replicate that has one or no participant, but before you can use that replicate, you must use cdr change replicate to add more participants. You cannot start and stop replicates that have no participants.

When you define a replicate, the replicate does not begin until you explicitly change its state to active. For more information, see cdr start replicate.

Important:
Do not create more than one replicate definition for each row and column set of data to replicate. If the participant is the same, Enterprise Replication attempts to insert duplicate values during replication.

Master Replicate Options

The master replicate options specify whether Enterprise Replication defines the replicate as a master replicate. A master replicate uses saved dictionary information about the attributes of replicated columns to verify that participants conform to the specified schema. You must specify at least one participant when creating a master replicate. All participants specified are verified when the cdr define replicate or cdr change replicate command is executed. If any participant does not conform to the master definition, then the command fails and that local participant is disabled. If a participant you specify does not contain the master replicate table, Enterprise Replication automatically creates the table on the participant based on the master replicate dictionary information. All database servers containing master replicates must be able to establish a direct connection with the master replicate database server. For more information, see Defining Master Replicates.

Read syntax diagramSkip visual syntax diagramMaster Replicate Options:
 
|-- --master=server--+----------+--+----------------+----------->
                     '- --empty-'  |          .-y-. |
                                   '- --name=-+-n-+-'
 
>--+---------------+--------------------------------------------|
   +- --verify-----+
   '- --autocreate-'
 
Element Purpose Restrictions Syntax
server Name of the database server from which to base the master replicate definition The name must be the name of a database server. Long Identifiers

The following table describes the master replicate options.

Long Form Short Form Meaning
--master= -M Specifies that the replicate being created is a master replicate.
--empty -t Specifies that the participant on the server specified with the --master option is used as the basis of the master replicate, but is not added to the replicate.
--name= -n Specifies whether the master replicate has column name verification in addition to column data type verification. The default is to have column name verification (-n y).
--verify -v Specifies that the cdr define replicate command verifies the database, tables, and column data types against the master replicate definition on all listed servers.
--autocreate -u Specifies that if the tables in the master replicate definition do not exist in the databases on the target servers, then they are created automatically. However, the table cannot contain columns with user-defined data types. The tables are created in the same dbspace as the database.

Conflict Options

The --conflict options specify how Enterprise Replication should resolve conflicts with data arriving at the database server.

For more information, see Conflict Resolution.

Read syntax diagramSkip visual syntax diagramConflict Options:
 
|-- --conflict=------------------------------------------------->
 
>--+-always-----------------------------------------+-----------|
   +-ignore-----------------------------------------+
   +-SPL_routine--+-------------+-------------------+
   |              '- --optimize-'                   |
   '-timestamp--+---------------------------------+-'
                '-,--SPL_routine--+-------------+-'
                                  '- --optimize-'
 
Element Purpose Restrictions Syntax
SPL_routine SPL routine for conflict resolution The SPL routine must exist. Long Identifiers

The following table describes the conflict options.

Long Form Short Form Meaning
--conflict= -C Specifies the rule that will be used for conflict resolution. The action that Enterprise Replication takes depends upon the scope. If scope is not specified, the default scope is transaction. Use the always option if you do not want Enterprise Replication to resolve conflicts, but you do want replicated changes to be applied even if the operations are not the same on the source and target servers. Use the ignore option if you do not want Enterprise Replication to resolve conflicts. Use the timestamp option to have the row or transaction with the most recent timestamp take precedence in a conflict.
--optimize -O Specifies that the SPL routine is optimized. An optimized SPL routine is called only when a collision is detected and the row to be replicated fails to meet one of the following two conditions:
  • It is from the same database server that last updated the local row on the target table.
  • It has a time stamp greater than or equal to that of the local row.
When this option is not present, Enterprise Replication always calls the SPL routine defined for the replicate when a conflict is detected.

Scope Options

The --scope options specify the scope of Enterprise Replication conflict resolution.

Read syntax diagramSkip visual syntax diagramScope Options:
 
|-- --scope=--+-row---------+-----------------------------------|
              '-transaction-'
 

The following table describes the --scope option.

Long Form Short Form Meaning
--scope= -S Specifies the scope that will be invoked when Enterprise Replication encounters a problem with data or a conflict occurs. For more information, see Scope. If scope is not specified, the default scope is transaction. When specifying the scope, you can abbreviate transaction to tra.

Special Options

Read syntax diagramSkip visual syntax diagramSpecial Options:
 
   .-------------------------.
   V                         |
|----+---------------------+-+----------------------------------|
     +- --ats--------------+
     +- --ris--------------+
     +- --floatieee--------+
     +- --floatcanon-------+
     +- --firetrigger------+
     +- --fullrow--+-y-+---+
     |             '-n-'   |
     '- --ignoredel--+-y-+-'
                     '-n-'
 

The following table describes the special options to cdr define replicate.

Long Form Short Form Meaning
--ats -A Activates aborted transaction spooling for replicate transactions that fail to be applied to the target database. For more information, see Setting Up Error Logging and Monitoring and Troubleshooting Enterprise Replication.
--firetrigger -T Specifies that the rows that this replicate inserts fire triggers at the destination. For more information, see Enabling Triggers.
--floatieee -I Transfers replicated floating-point numbers in either 32-bit (for SMALLFLOAT) or 64-bit (for FLOAT) IEEE floating-point format. Use this option for all new replicate definitions. For more information, see Using the IEEE Floating Point or Canonical Format.
--floatcanon -F Transfers replicated floating-point numbers in machine-independent decimal representation. This format is portable, but can lose accuracy. This format is provided for backward-compatibility only; use --floatieee for all new replicate definitions. For more information, see Using the IEEE Floating Point or Canonical Format.
--fullrow y | n -f y | n Specifies to (y) replicate the full row and enable upserts or (n) replicate only changed columns and disable upserts. By default, Enterprise Replication always replicates the entire row and enables upserts. For more information, see Replicating Only Changed Columns.
--ignoredel y | n -D y | n Specifies that rows are retained if they are deleted on other nodes in the Enterprise Replication system.
--ris -R Activates row-information spooling for replicate row data that fails conflict resolution or encounters replication order problems. For more information, see Setting Up Error Logging and Monitoring and Troubleshooting Enterprise Replication.

Shadow Replicate Options

A shadow replicate is a copy of an existing, or primary, replicate. You must create a shadow replicate to perform a manual remastering of a replicate that was defined with the -n option. After creating the shadow replicate, the next step in manual remastering is to switch the primary replicate and the shadow replicate using the cdr swap shadow command.

Read syntax diagramSkip visual syntax diagramShadow Replicate Options:
 
|--+-------------------------------------------------+----------|
   '- --mirrors--primary_replicate--shadow_replicate-'
 
Element Purpose Restrictions Syntax
primary_replicate Name of the replicate on which to base the shadow replicate The replicate must exist. The replicate name must be unique. Long Identifiers
shadow_replicate Name of the shadow replicate to create The replicate name must be unique. Long Identifiers

The following table describes the shadow replicate option to cdr define replicate.

Long Form Short Form Meaning
--mirrors -m Specifies that the replicate created is a shadow replicate based on an existing primary replicate.

Examples

The following example illustrates the use of cdr define replicate:

cdr define repl --conflict=timestamp,sp1 \
--scope=tran --ats --fullrow n --floatieee newrepl \
"db1@iowa:antonio.table1" "select * from table1" \
"db2@utah:carlo.table2" "select * from table2"

Line 1 of the example specifies a primary conflict-resolution rule of timestamp. If the primary rule fails, the SPL routine sp1 will be invoked to resolve the conflict. Because no database server is specified here (or on any later line), the command connects to the database server named in the INFORMIXSERVER environment variable.

Line 2 specifies that the replicate has a transaction scope for conflict-resolution scope and enables aborted transaction spooling. Enterprise Replication will only replicate the rows that changed and uses the IEEE floating point format to send floating-point numbers across dissimilar platforms. The final item specifies the name of the replicate, newrepl.

Line 3 defines the first participant, "db1@iowa:antonio.table1", with the select statement "select * from table1".

Line 4 defines a second participant, "db2@utah:carlo.table2", with the select statement "select * from table2".

The next example is the same as the preceding example with the following exceptions:

cdr def repl -c ohio -C timestamp,sp1 \
-S tran -A -e 5:00 -I newrepl \
"db1@iowa:antonio.table1" "select * from table1" \
"db2@utah:carlo.table2" "select * from table2"

The following example illustrates creating a master replicate:

cdr def repl -c iowa -M iowa \
-C timestamp -S tran -D y newrepl \
"db1@iowa:antonio.table1" "select * from table1"

Line 1 instructs Enterprise Replication to create a master replicate based on the replicate information from the database server iowa. Line 2 specifies the conflict and scope options, that delete operations are ignored, and that the name of the replicate is newrepl. Line 3 specifies the table and columns included in the master replicate.

The next example is the same as the previous example except that it specifies a second participant in Line 4. The second participant (utah) does not have the table table1 specified in its participant and modifier syntax; the execution of the cdr define replicate command creates table1 on the utah server.

cdr def repl -c iowa -M iowa \
-C timestamp -S tran -D y newrepl \
"db1@iowa:antonio.table1" "select * from table1 \
"db2@utah:carlo.table1" "select * from table1"

See Also

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]