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

cdr realize template

The cdr realize template command realizes a template on all or a subset of the database servers within the replication domain.

Syntax

Read syntax diagramSkip visual syntax diagram>>-cdr realize template--+-------------------------+------------>
                         |                    (1)  |
                         '-| Connect Option |------'
 
>--template----------------------------------------------------->
 
>--+--------------------------------------------------------------------+-->
   '- --syncdatasource=data_server--+---------------------------------+-'
                                    '- --extratargetrows=--+-delete-+-'
                                                           +-keep---+
                                                           '-merge--'
 
>--+---------------------------------------+--+-----------+----->
   +- --verify-----------------------------+  '- --target-'
   '- --autocreate--+--------------------+-'
                    '- --dbspace=dbspace-'
 
   .---------------------------------------------.
   V                                             |
>----+-----------+-server_group-+--------------+-+-------------->
     '-database@-'              '-:owner.table-'
 
>--+-----------------+-----------------------------------------><
   '- --applyasowner-'
 
Notes:
  1. See page Connect Option.
Element Purpose Restrictions Syntax
database Name of the database that includes the table to be replicated The database server must be registered with Enterprise Replication. Long Identifiers
data_server The database server from which the data is copied to all other database servers listed The database server must be defined in Enterprise Replication.
dbspace The name of the dbspace for Enterprise Replication to use when creating tables The dbspace must exist on all the database servers listed. If you do not specify a dbspace name and new tables are created, they are created in the default dbspace.
owner User ID of the owner of the table to be replicated Long Identifiers
server_group Name of the database server group that includes the server to connect to The database server group name must be the name of an existing Enterprise Replication server group in SQLHOSTS. Long Identifiers
table Name of the table to be replicated The table must be an actual table. It cannot be a synonym or a view. Long Identifiers
template The name of the template The template must exist. Use the cdr define template command to create the template. For more information, see cdr define template. Long Identifiers

The following table describes the special options to cdr realize template.

Long Form Short Form Meaning
--applyasowner -o Specifies that the template is realized by the owner of the table specified when the template was defined. By default, the template is realized by the user informix.
--autocreate -u Specifies that if the tables in the template 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.
--dbspace= -D Specifies the dbspace in which the automatically created objects are placed. If not specified, then the default dbspace is used. (default)
--extratargetrows= -e Specifies how to handle rows found on the target servers that are not present on the data source server from which the data is being copied (data_server):
  • delete: (default) remove rows and dependent rows, based on referential integrity constraints, from the target servers
  • keep: retain rows on the target servers
  • merge: retain rows on the target servers and replicate them to the data source server
This option applies to the initial data synchronization operation only; it does not affect the behavior of the replicate.
--syncdatasource= -S Specifies which server is the source of the data that is used to synchronize all the other servers listed in the cdr realize template command.
--target -t

4Specifies that all of the servers listed 4in the command become receive-only servers, including the source server, unless 4the template has already been realized on the source server.

If you use this option, you must run the cdr realize template command twice: once to realize the template on the source server and other primary servers, and again to realize the template on receive-only servers.

--verify -v Specifies that the cdr realize template command verifies that the database, tables, column data types are correct on all listed servers, but does not realize the template.

Usage

Templates provide an efficient way to create replicates and a replicate set, create the participant tables, and synchronize data. The cdr realize template and cdr define template commands are an alternative to using the cdr define replicate and commands once each for every replicate, plus the cdr define replicateset command.

Before you can use the cdr realize template command, you must define Enterprise Replication servers using the cdr define server command and define the template using the cdr define template command. You should also create the database to be replicated on all database servers in the replication domain. However, only the database on the synchronization data source server needs to be populated with data.

The cdr realize template command performs the following tasks:

The replicates and replicate set created from a template have generated names. Use the cdr list template command to see the names of the replicates and replicate set associated with a particular template.

Examples

The following example illustrates the cdr realize template command:

cdr realize template tem1 -c detroit\
new_cars@detroit new_cars0@chicago new_cars1@newark\
new_cars2@columbus

Line 1 specifies that the template name is tem1 and the server to connect to is the detroit server. Line 2 lists the names of the databases and database servers on which to realize the template.

The following example illustrates realizing the template on the source server, and then, creating the databases and tables, and loading data on the target receive-only database servers:

cdr realize template tem1 -c detroit detroit\
cdr realize template tem1 -c detroit\
--syncdatasource=detroit --extratargetrows=keep\
--target chicago newark columbus

Line 1 realizes the template on the detroit server, as a primary server by default.

Line 3 specifies to use the detroit server as the source of the data to replicate to all other participating servers. If Enterprise Replication encounters any rows on the chicago, newark, or columbus servers that do not exist on the detroit server, those rows are kept.

Line 4 specifies the participant type for each server. The --target option makes all servers receive-only participants.

The following example verifies the database and table attributes on the chicago, newark, and columbus servers; the template is not realized on these servers:

cdr realize template tem1 -c detroit\
--verify chicago newark columbus

See Also

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