cdr remaster

The cdr remaster command changes the SELECT clause or the server from which to base the master replicate definition of an existing master replicate. This command can also convert a classic (non-master) replicate to a master replicate.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-cdr remaster--+--------------------------+------------------->
                 |                      (1) |   
                 '-| Connect Option   |-----'   

>--+- --master=server--replicate--+----------+--+----------+-+-><
   |                              '-modifier-'  '- --erkey-' |   
   '-| Removing columns |------------------------------------'   

Removing columns

|-- --remove---------------------------------------------------->

   .------------------------------------------------------.   
   |                       .----------------------------. |   
   |                       |                 .--------. | |   
   V                       V                 V        | | |   
>---- --database=database---- --table=table----column-+-+-+----->

>--+-------------------------+----------------------------------|
   '- --wait--=--+-seconds-+-'   
                 '- -1-----'     

Notes:
  1. See Connect Option.
Element Purpose Restrictions Syntax
column Name of the column to remove from replication. The column must exist and be a replicated column.  
database Name of the database from which to remove one or more columns from replication. The database must exist and contain replicated tables.  
modifier Specifies the rows and columns to replicate.   Participant and participant modifier
replicate Name of the replicate to be mastered. The replicate must exist. Long Identifiers
server Name of the database server group from which to base the master replicate definition. The name must be the database server group name. Long Identifiers
table Name of the table from which to remove one or more columns from replication. The table must exist and belong to a replicate.  

The following table describes the options to the cdr remaster command.

Long Form Short Form Meaning
--database= -d Specifies the database name from which to delete replicated columns.
--erkey -K Includes the ERKEY shadow columns, ifx_erkey_1, ifx_erkey_2, and ifx_erkey_3, in the participant definition, if the table that is being replicated has the ERKEY shadow columns.

The ERKEY shadow columns are used as the replication key.

--master= -M Specifies that the replicate being created is a master replicate.
--remove -r Removes the specified columns from replicate definitions.
--table= -t Specifies the table name from which to remove one or more replicated columns.
--wait= -w Specifies how long to wait for remastering to complete. Default is -1: wait indefinitely until all replicates are finished being remastered.

If the remaster operation is not complete at the end of the waiting time, the operation is rolled back and the columns are not removed.

Usage

Remastering updates the replicate definition in the global catalogs of the replication servers. Use the cdr remaster command to perform one of the following tasks:
  • Convert a classic replicate to a master replicate. Master replicates ensure schema consistency among the participants in the replicates.
  • Update the definition of a master replicate whose participant was changed in an alter operation. You can change the SELECT clause or the server from which to base the master replicate definition.
  • Remove one or more replicated columns from one or more replicates. The columns can belong to different replicates. You do not need to know the names of the replicates.

To use the cdr remaster command, the master replicate definition must be created with name verification turned on, by using the cdr define replicate command with the --name=y option.

Use the --erkey option if you are adding ERKEY columns to the participant definition, or if you are changing a participant definition that contains the ERKEY shadow columns.

You can run this command from within an SQL statement by using the SQL administration API.

The remastering operation creates temporary shadow replicates that are deleted when the remastering operation is complete. If shadow replicates exist, the remastering operation is in progress. You can run the cdr list replicate command to determine if the shadow replicate exists. An example of a shadow replicate name is:
Shadow_4_Repl1_GMT1090373046_GID10_PID28836

Shadow replicate names have the following format:

Shadow_4_basereplicatename_GMTtime_GIDgroupID_PIDpid
basereplicatename
The name of the replicate that is being remastered. If the replicate name is longer than 64 characters, only the first 64 characters are included.
time
The time stamp of when the shadow replicate was created, in GMT.
groupID
The group ID of the server. The group ID is the number that is specified by the -i option in the group definition in the sqlhosts file.
pid
The process ID of the client computer.

Example: Add columns to a replicate definition

The following command shows the original definition of the master replicate before the alter operation:
cdr define repl --master=delhi -C timestamp\
newrepl "test@delhi.tab" "select col1, col2 from tab"\
The following command shows the cdr remaster command adding a column, col3, in the newrepl participant:
cdr remaster --master=delhi newrepl\
"select col1, col2, col3 from tab"

The following command shows adding the ERKEY shadow columns after the table was altered to include them:

cdr remaster --master=delhi newrepl --erkey\
"select col1, col2, col3 from tab"

The following command shows changing the participant in the previous example to add another column and to continue to include the ERKEY shadow columns:

cdr remaster --master=delhi newrepl --erkey\
"select col1, col2, col3, col4 from tab"

Example: Remove columns from replicate definitions

The following command removes three columns from the database mydb: the column prefix from the table customer and the columns discount and season from the table sales:

cdr remaster --remove --database=mydb --table=customer prefix \
--table=sales discount season 

The following command removes one column each from the databases mydb1, mydb2, and mydb3:

cdr remaster --remove --database=mydb1 --table=customer prefix \
--database=mydb2 --table=cars brand \
--database=mydb3 --table=regions northwest 

Copyright© 2018 HCL Technologies Limited