http://goo.gl/EmKxy0

Home > ASE, Installation, Replication Server > Adding a Replicate DB in Replication Server without rs_init

Adding a Replicate DB in Replication Server without rs_init

Hi Guys,
Now the task is : We want to move the data from PROD_ASE.pdb to new database PROD_ASE.rdb2. We want to complete this setup without using rs_init.

Always remember, whenever we want to add a primary/replicate database, we need a connection. A connection always represents a replicate database (means connection must be having DSI thread).

We will use the same pdb , which we added in previous post, Now I am going to add rdb2 database in RSS. Basically it requires a connection and some set of tables in rdb which requires for replication.

1. Created rdb2 on data and log device.

create database rdb2  on rep_db3_data=’5M’ log on rep_db3_log=’4M’

create a table in database :

1> use rdb2
2> go
1>  create table table1 ( col1 int primary key, col2 varchar(10))
2> go

2. Add maint user login for rdb2 as rdb2_maint

1> sp_addlogin rdb2_maint,rdb2_maint_ps,rdb2
2> go
Password correctly set.
Account unlocked.
New login created.
(return status = 0)

3. Add the rdb2_main user in the database rdb2 as dbo alias

(To avoid any pemission issue, even we can add it as simple user ,

in that case for each and every table we need to grant the permission separately)

1> use rdb2
2> go
1> sp_addalias rdb2_maint,dbo
2> go
Alias user added.
(return status = 0)

4. Grant the replication Role to maint user

1> grant role replication_role to rdb2_maint
2> go

5. Install the replication table in rdb2 database by script rs_install_replicate.sql

[sybase@localhost scripts]$ isql -Usa -SPROD_ASE -Dpdb2 -w999 -irs_install_replicate.sql -ors_install_replicate.sql.out

This script resides in script folder of replication server.

After the installation of script you will have following tables in rdb2 DB

1> use rdb2
2> go
1> select name from sysobjects where name like ‘rs%’
2> go
name
———–
rs_get_lastcommit
rs_get_thread_seq
rs_initialize_threads
rs_lastcommit
rs_threads
rs_ticket_report
rs_update_lastcommit
rs_update_threads

(8 rows affected)

6. Now login into Replication Server andcreate the connection as :

1>
2> create connection to PROD_ASE.rdb2
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to rdb2_maint
set password to rdb2_maint_ps

3> 4> 5> 6> 7>

8> go
Connection to ‘PROD_ASE.rdb2’ is created.

Make sure there is no thread down

7. As we already created the replication def for pdb.table1 table, we will use here.

Now create the subscription for PROD_ASE.rdb2

1>
2> create subscription repdef_pdb_table1_sub
3> for repdef_pdb_table1
4> with replicate at PROD_ASE.rdb2
5> without materialization
6> go
Subscription ‘repdef_pdb_table1_sub’ is in the process of being created.
1> check subscription repdef_pdb_table1_sub
for repdef_pdb_table1
with replicate at PROD_ASE.rdb2

2> 3>
4> go
Subscription repdef_pdb_table1_sub is VALID at the replicate.
Subscription repdef_pdb_table1_sub is VALID at the primary.
1>

8. Test the replication now, set up is completed:

1> use pdb
2> go
1> insert table1 values(1890,’val’)
2> go
(1 row affected)
1> use rdb2
2> go
1> select * from table1
2> go
col1        col2
———– ——————–
1890 val

(1 row affected)
1> use rdb
2> go
1> select * from table1
2> go
col1        col2
———– ——————–
100 val1
101 val2
1890 val

(3 rows affected)

Check the Sybase Wiki @ sybasewiki.com
  1. No comments yet.
  1. No trackbacks yet.