Skip to content

How to add/delete replication target table#

Overview#

This document describes how to add or delete replication target tables in the replication object.

Version#

Altibase all versions

Adding replication target table#

This is the procedure for adding tables to be replicated in the replication object.

  1. Stop the replication

    Execute in the server where the replication sending thread is running.

    With the statement below, the replication sender of the local server and the receive thread of the remote server are stopped.

    iSQL> ALTER REPLICATION replication_name STOP;
    
    -- Check the replication running status
    iSQL> SELECT REPLICATION_NAME, DECODE(IS_STARTED, 0, 'STOPPED', 1, 'STARTED') IS_STARTED FROM SYSTEM_.SYS_REPLICATIONS_;
    
  2. Add the replication target table

    This is the statement for adding a replication target table to the replication object. Execute this on each of the replication target servers.

    iSQL> ALTER REPLICATION replication_name ADD TABLE FROM user_name.table_name TO user_name.table_name;
    

    Verify that the table was added to the replication object.

    iSQL> SELECT REPLICATION_NAME, LOCAL_USER_NAME, LOCAL_TABLE_NAME FROM SYSTEM_.SYS_REPL_ITEMS_;
    
  3. SYNC the replication

    If the data on both servers do not match, TRUNCATE one server's table and then perform a SYNC statement on the server where the data exists to match the data.
    If the data matches on both servers, perform 4. Start the replication.

    iSQL> ALTER REPLICATION replication_name SYNC ONLY TABLE user_name.table_name;
    
  4. Start the replication

    If the data on both servers match each other, execute the replication start statement.

    iSQL> ALTER REPLICATION replication_name START;
    
    -- Check the replication running status
    iSQL> SELECT REPLICATION_NAME, DECODE(IS_STARTED, 0, 'STOPPED', 1, 'STARTED') IS_STARTED FROM SYSTEM_.SYS_REPLICATIONS_;
    

Deleting replication target table#

This is the procedure for deleting tables to be replicated in the replication object.

  1. Stop the replication

    Execute in the server where the replication sending thread is running.

    With the statement below, the replication sender of the local server and the receive thread of the remote server are stopped.

    iSQL> ALTER REPLICATION replication_name STOP;
    
    -- Check the replication running status
    iSQL> SELECT REPLICATION_NAME, DECODE(IS_STARTED, 0, 'STOPPED', 1, 'STARTED') IS_STARTED FROM SYSTEM_.SYS_REPLICATIONS_;
    
  2. Delete the replication target table

    This is the statement for deleting the replication target table in the replication object. Execute this on each of the replication target servers.

    iSQL> ALTER REPLICATION replication_name DROP TABLE FROM user_name.table_name TO user_name.table_name;
    
    -- Statement for checking the replication target table
    iSQL> SELECT REPLICATION_NAME, LOCAL_USER_NAME, LOCAL_TABLE_NAME FROM SYSTEM_.SYS_REPL_ITEMS_;
    
  3. Start the replication

    iSQL> ALTER REPLICATION replication_name START;
    
    -- Check the replication running status
    iSQL> SELECT REPLICATION_NAME, DECODE(IS_STARTED, 0, 'STOPPED', 1, 'STARTED') IS_STARTED FROM SYSTEM_.SYS_REPLICATIONS_;
    

Reference#