cdr define template
The cdr define template command creates a template for replicates and a replicate set.
Syntax
Element | Purpose | Restrictions | Syntax |
---|---|---|---|
template | Name of the template to create. | The template name must be unique and cannot be the same as a replicate or replicate set name. | Long Identifiers |
database | Name of the database that is used to define the template attributes. | The database server must be registered with Enterprise Replication. | Long Identifiers |
table | Name of the table to be included in the template. | The table must be an actual table. It cannot be a synonym or a view. For ANSI databases, you must specify owner.tablename. | Long Identifiers |
filename | The directory and file name of the file that contains a list of tables to be included in the template. | Must be a full path name and file name. The path and file name can be no longer than 256 bytes. Within the file, the table names can be separated by a space or placed on different lines. | Follows naming conventions on your operating system. |
server_group | Name of a database server group to declare for Enterprise Replication. | Must be the name of an existing database server group in SQLHOSTS. | Long Identifiers |
The following table describes the options to cdr define template.
Long Form | Short Form | Meaning |
---|---|---|
--all | -a | Specifies that all tables in the database are included in the template. |
--database= | -d | Specifies which database the template is based on. If no tables or table list file name are listed after this option, then all tables in the database are included in the template. |
--exclusive | -X | Creates an exclusive replicate set. The state of the replicate set is inactive until you apply the template. This option is required if you have referential integrity constraints on a table. |
--file= | -f | Specifies the path and file name of a file that lists the tables to be included in the template. The file must contain only table names, either separated by spaces or each on its own line. |
--master= | -M | Specifies the server that contains the database to be used as the basis of the template. If this option is not specified, then the server that is specified in the connect option is used. |
Special Options
The following table describes the special options to the cdr define template command.
Long Form | Short Form | Meaning |
---|---|---|
--alwaysRepLOBS= | Specifies whether columns that contain unchanged
large objects are included in replicated rows:
|
|
--anyUniqueKey | -U | Specifies that the replication key is detected
automatically from the following sources in the follow order:
The replicate must be a strictly mastered replicate. If the table includes ERKEY shadow columns, those columns are included in the participant definition only if the table does not have a primary key. |
--ats | -A | Activates aborted transaction spooling for replicate transactions that fail to be applied to the target database. |
--firetrigger | -T | Specifies that the rows that the replicate inserts fire triggers at the destination. |
--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. |
--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 compatibility with earlier versions only; use --floatieee for all new replicate definitions. |
--fullrow= | -f | Specifies whether to replicate full rows or only the changed columns:
|
--ignoredel= | -D | Specifies whether to retain deleted rows on other
nodes:
|
--ris | -R | Activates row-information spooling for replicate row data that fails conflict resolution or encounters replication order problems. |
--UTF8= | None | Specifies
whether to enable conversion to and from UTF-8 (Unicode) when you
replicate data between servers that use different code sets.
|
Usage
A template consists of schema information about a database, a group of tables, column attributes, and the replication keys that identify rows. A template defines a group of master replicates and a replicate set. Templates are an alternative to using the cdr define replicate and cdr start replicate commands for each table and manually combining the replicates into a replicate set by using the cdr define replicateset command.
The replicate set can be exclusive or non-exclusive. Specify that the replicate set is exclusive if you have referential constraints that are placed on the replicated columns. If you create an exclusive replicate set using a template, you do not stop the replicate set to add replicates. The cdr define template command performs this task automatically.
If your tables include the ERKEY shadow columns, they are automatically added to replicate definition when you define a template. The --erkey option is not needed with the cdr define template command.
You cannot specify an SPL routine for conflict resolution when you define a template.
After you define a template by running the cdr define template command, use the cdr realize template command to apply the template to your Enterprise Replication database servers.
You cannot update a template. To modify a template, you must delete it and then re-create it with the cdr define template command.
You can run this command from within an SQL statement by using the SQL administration API.
Examples
cdr define template tem1 -c detroit\
-C timestamp -S tran \
--master=chicago\
--database=new_cars table1 table2 table3
Line 1 of the
example specifies a template name of tem1 and that the connection
is made to the server detroit. Line 2 specifies a conflict-resolution
rule of timestamp and a transaction scope for conflict resolution.
Line 3 specifies that the master replicate information is obtained
from the server chicago. Line 4 specifies to use the new_cars database
on the chicago server and to include only the tables table1, table2,
and table3.cdr define template tem1 -c detroit\
-C timestamp -S tran --master=chicago\
--ignoredel=y\
--database=new_cars --file=tabfile.txt
Line 3 indicates
that delete operations are not replicated. Retaining deleted rows
on target servers is useful for consolidation models.table1
table2
table3
table4