Add a replicate table to an existing replication server

From SybaseWiki
Jump to: navigation, search

With the replication server setup as described at this page Warm Standby setup instructions it is easy to add a replicate table to it. Follow these steps.

Mark the table that hold the primary data for replication

On the primary ASE that manages the data for the warm standby setup you need to mark each table for replication. For instance, when you want to replicate data changes for a table called ‘myTable’ run this command:

use <database>
sp_setreptable myTable,"true"

Prepare the replicate database

If not already there, create a Sybase ASE server and a database that will be used to store the replicate table.

This page assumes that the tables on the replicate ASE are created identical as those on the primary ASE. When done, you need to run a Sybase supplied script to create some extra tables needed by replication server. The script is called rs_install_replicate.sql and is located at $SYBASE/$SYBASE_REP/scripts. Example how to load the script:

isql -U<login> -P<password> -S<server> -D<database> < $SYBASE/$SYBASE_REP/scripts/rs_install_replicate.sql

Create the maintenance user on the replicate ASE

Create a login on the replicate ASE that will be used by replication server to maintain the data. It is the maintenance user.

sp_addlogin "<maintenance user>","<maintenance_user_password>"
use <database>
sp_addalias "<maintenance user>",”dbo”

Check interfaces file

Make sure that the interfaces file of the replication server has an entry to connect to the replicate ASE.

Create a connection

Create a connection from the replication server to the ASE server and database.

create connection to <replicate ASE>.<database>
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to <maintenance user>
set password to '<maintenance_user_password>'

Create replication definition

Create replication definitions for the table, see example below.

create replication definition RD_myTable
with primary at L1.peter
with all tables named 'myTable'
("sequ" identity,
"dt" datetime)
primary key("sequ")
replicate minimal columns

Create subscription

Create a subscription for the table

create subscription A5_myTable
for RD_myTable
with replicate at A5.peter

That’s all.