>>-cdr define template--template--+-------------------------+---> | (1) | '-| Connect Option |------' (2) >--| Conflict Options |-------+------------------------+--------> | (3) | '-| Scope Options |------' >--+----------------------------+-------------------------------> | (4) | '-| Frequency Options |------' >--+--------------------------+---------------------------------> | (5) | '-| Special Options |------' .-------. V | >-- --master=server_group--+--------------+-- --database=database--+---table-+--------+->< '- --exclusive-' +- --all-----------+ '- --file=filename-'
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 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 filename of the file containing a list of tables to be included in the template | Must be a full pathname and filename. The path and filename 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. See Setting up Database Server Groups. | 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 filename 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. For more information, see Exclusive Replicate Sets. |
--file= | -f | Specifies the path and filename 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 specified in the connect option is used. For more information on master replicates, see Defining Master Replicates. |
A template consists of schema information about a database, a group of tables, column attributes, and the primary keys that identify rows. A template defines a group of master replicates and a replicate set.
The replicate set can be exclusive or non-exclusive. Specify that the replicate set is exclusive if you have referential constraints placed on the replicated columns. If you create an exclusive replicate set using a template, you do not need to stop the replicate set to add replicates. The cdr define template command performs this task automatically.
After you define a template using 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.
The following example illustrates the cdr define template command:
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.
The next example is the same as the first except that it has additional options and uses a file instead of a list of tables:
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.
Line 4 specifies a filename for a file that contains a list of tables to include in the template. The tabfile.txt file has the following contents:
table1 table2 table3 table4