cdr realize template
The cdr realize template command creates the replicates, replicate set, and participant tables as specified in a template, and then synchronizes data on all or a subset of the database servers within the replication domain.
Syntax
Element | Purpose | Restrictions | Syntax |
---|---|---|---|
database | Name of the database that includes the table to be replicated. | The database server must be in an Enterprise Replication domain. | Long Identifiers |
data_server | The database server from which the data is copied to all other database servers listed. | The database server must be in an Enterprise Replication domain. | |
dbspace | The name of the dbspace for 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. | |
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 |
sizeK or size M | Size, in either kilobytes (K) or megabytes (M), of the send queue during synchronization. | Must be a positive integer and must not be greater than the amount of available memory. | |
template | The name of the template. | The template must exist. Use the cdr define template command to create the template. | Long Identifiers |
The following table describes the special options to cdr realize template.
Long Form | Short Form | Meaning |
---|---|---|
--applyasowner | -o | Specifies that any tables created when you realize the template are owned by the owner of the source tables. By default, the tables are owned 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, they are created
automatically. However, the tables cannot contain columns with user-defined
data types. Note: Tables that are created with autocreate do not automatically include
non-replicate key indexes, defaults, constraints (including foreign
constraints), triggers, or permissions. You must manually create these
objects. |
--dbspace= | -D | Specifies the dbspace in which the automatically created objects are placed. If not specified, then the default dbspace is used. |
--extratargetrows= | -e | Specifies how to handle rows that are found on
the target servers that are not present on the data source server
from which the data is being copied (data_server):
|
--foreground | -F | Specifies that the synchronization operation is performed as a foreground process. |
--memadjust= | -J | Increases the size of the send queue during synchronization to the number of kilobytes or megabytes specified by the size element. |
--mode= | -m | Specifies whether the participant either only sends
or only receives replicated data:
|
--syncdatasource= | -S | Specifies which server is the source of the data
that is used to synchronize all the other servers that are listed
in the cdr realize template command. The server that is listed with this option must either be listed as one of the servers on which to realize the template, or it must already have the template. |
--target | -t | Specifies that all of the servers that are listed in the command become receive-only servers, including the source server, unless the template is already 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
Before you can use the cdr realize template command, you must define Enterprise Replication servers by running the cdr define server command and define the template by running the cdr define template command. Create the database to be replicated on all database servers in the replication domain. However, only the database on the synchronization data source server must be populated with data.
All specified servers must be online and the cdr utility must be able to connect to each server.
If you run this command as a DBSA instead of as user informix, you must have INSERT, UPDATE, and DELETE permission on the replicated tables on all the replication servers in the domain.
The cdr realize template command performs the following tasks:
- If you specify the --autocreate option, creates
database tables on the target servers. Recommendation: If you use --autocreate, specify a dbspace name. If you do not specify a dbspace name, tables are created in the root dbspace, which is not recommended.
- If you specify the --verify option, verifies the database, tables, column data types, and replication keys on all participating servers; however, the template is not realized.
- If you specify the --syncdatasource option, synchronizes the data from the source database with the
databases specified by this command. If you specify the --foreground option, runs synchronization as a foreground process. If you specify
the --memadjust option, increases the size of the
send queue from the value of the CDR_QUEUEMEM configuration parameter.
If you are running this command with the --syncdatasource option as a DBSA, you must have certain permissions granted to you on several system tables in the syscdr database. For more information, see Preparing for Role Separation (UNIX).
- Verifies the database and table attributes to ensure that replication can be performed on each database.
- Creates replicates as master replicates on all servers.
- Creates a replicate set for the new replicates.
- Starts the replicates on all servers.
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.
You can run this command from within an SQL statement by using the SQL administration API.
You can run the cdr check queue --qname=cntrlq command to wait for the cdr realize template command to be applied at all Enterprise Replication servers before you run the data synchronization task.
Examples
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 which to connect is the detroit server. Lines 2 and 3 list the names of the databases and database
servers on which to realize the template.cdr realize template tem1 -c detroit\
--syncdatasource=detroit --extratargetrows=keep\
--foreground --memadjust=50M\
--target chicago newark columbus
cdr realize template tem1 -c detroit\
--syncdatasource=detroit --extratargetrows=keep\
--foreground --memadjust=50M\
--mode=receive_only chicago newark columbus
Line 1 realizes
the template on the detroit server, as a primary server by
default. Line 2 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 3 specifies that the synchronization operation is done in the foreground, and the size of the send queue is set to 50 MB.
Line 4 specifies the participant type for each server. The --target option makes all servers receive-only participants. The --mode=receive_only option makes each server a receive-only participant.
cdr realize template tem1 -c detroit\
--verify chicago newark columbus