>>-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-'
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.
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:
Recommendation: if you use --autocreate, specify a dbspace name. If you do not, tables are created in the root dbspace, which is not recommended.
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.
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