CREATE REPLICATION
CREATE REPLICATION#
Syntax#
create_replication ::=#
option_clause ::=#
replication_item ::=#
Prerequisites#
Only the SYS user can execute replication-related statements.
Description#
This statement is used to create a replication object, set the connection between a local server and one or more remote servers, and establish replication there between. Replication takes place between tables on a 1:1 basis; that is, a table is matched to only one corresponding table.
In order to resolve conflicts, the AS MASTER or AS SLAVE clause can be specified in the statement. Doing so stipulates that a master-slave scheme is to be used to resolve conflicts. For more detailed information about replication conflict resolution, please refer to Chapter 2 of the Replication Manual.
replication_name#
This is used to specify the name of the replication object. The replication object name must be the same on both the local server and the remote server. Refer to "Rules for Object Names" for more information on specifying names.
FOR ANALYSIS | FOR ANALYSIS PROPAGATION#
This creates the Xlog Sender. For more detailed information about properties, please refer to the Log Analyzer User's Manual.
FOR PROPAGABLE LOGGING#
This is used to write logs received by the propagable receiver from the local server in order to replicate into other server. However, this function cannot be used with the recovery option.
FOR PROPAGATION#
The propagable logs are transmitted to other target server.
option_clause#
This is used to optionally specify the RECOVERY, OFFLINE, GROUPING, PARALLEL, and GAPLESS functions for the replication object. These features are for use in data recovery and when performing offline replication, respectively. For more information, please refer to Chapter 3 of the Replication Manual.
replication_host_ip#
This is used to specify the IP address of the remote server.
replication_host_port_no#
This is used to specify the port number used by the Receiver thread on the remote server. It is identical to the REPLICATION _PORT_NO property in the altibase.properties file on the remote server.
USING conn_type [ib_latency]#
The communication method (TCP or InfiniBand) can be set with the remote server. The ib_latency value can be set only when using InfiniBand. To use InfiniBand, the IB_ENABLE property must have a value of 1.
user_name#
This is used to specify the name of the owner of the table to be replicated.
tbl_name#
This is used to specify the name of the table to be replicated.
partition_name#
This is used to specify the name of the partition to be replicated.
Examples#
<Query> Create replication rep1 according to the following conditions:
-
The IP address of the local server is 192.168.1.60.
-
The replication port number on the local server is 25524.
-
The IP address of the remote server is 192.168.1.12.
-
The replication port number on the remote server is 35524.
Create the replication object to replicate the employees and departments tables between the servers.
On the local server (IP: 192.168.60) :
iSQL> CREATE REPLICATION rep1
WITH '192.168.1.12',35524
FROM sys.employees TO sys.employees,
FROM sys.departments TO sys.departments;
Create success.
On the remote server (IP: 192.168.1.12) :
iSQL> CREATE REPLICATION rep1
WITH '192.168.1.60',25524
FROM sys.employees TO sys.employees,
FROM sys.departments TO sys.departments;
Create success.
<Query> After the remote server received the log in replication Rep 1, create replication Rep2 for the propagable logs and sends them to target server.
iSQL> CREATE REPLICATION rep1
FOR PROPAGABLE LOGGING WITH '192.168.1.12',35524
FROM sys.t1 TO sys.t1;
iSQL> SELECT replication_name, role
FROM system_.sys_replications_;
REPLICATION_NAME ROLE
---------------------------------------------------------
REP1 2
1 row selected.
iSQL> CREATE REPLICATION rep2
FOR PROPAGATION WITH '192.168.1.60',25524
FROM sys.t1 TO sys.t1;
Create success.
iSQL> SELECT replication_name, role
FROM system_.sys_replications_;
REPLICATION_NAME ROLE
---------------------------------------------------------
REP2 3
1 row selected.