http://goo.gl/EmKxy0

Home > ASE, Installation, Replication Server, Sybase ASE/REP Interview Questions > Adding a Primary DB in Replication Server without rs_init

Adding a Primary DB in Replication Server without rs_init

Task :  Adding a Primary Database to Replication Server without using rs_init.  So now we will me moving the data out to PROD_ASE.pdb2 database

1. Create the new database pdb2 as below                     <DS>

1> create database pdb2  on rep_db3_data=’5M’ log on rep_db3_log=’4M’

2> go

00:00:00000:00014:2011/04/23 04:07:02.01 kernel  Setting console to nonblocking mode.

00:00:00000:00014:2011/04/23 04:07:02.01 server  Timestamp for database ‘pdb2’ is (0x0000, 0x00001428).

CREATE DATABASE: allocating 2560 logical pages (5.0 megabytes) on disk

‘rep_db3_data’ (2560 logical pages requested).

CREATE DATABASE: allocating 1536 logical pages (3.0 megabytes) on disk

‘rep_db3_log’ (2048 logical pages requested).

Database ‘pdb2’ is now online.

Creating a table for moving the data   <DS>      

1> use pdb2

2> go

1> create table table2 ( col1 int primary key, col2 varchar(10))

2> go

2. Again create the maint user login and add the maint user in pdb2 ( I made it as alias, but we can also add it as simple user)          <DS>      

1> sp_addlogin pdb2_maint,pdb2_maint_ps,pdb2

2> go

Password correctly set.

Account unlocked.

New login created.

(return status = 0)

1> use pdb2

2> go

1> sp_addalias pdb2_maint,dbo

2> go

Alias user added.

(return status = 0)

3. Grant the replication role to pdb2_maint login.         <DS>  

1> grant role replication_role to pdb2_maint

2> go

4. Need to install the some system tables and stored procs in pdb2 for proper function as Primary database.    <DS>

Move int $SYBASE/$SYBASE_REP/scripts/

Run the script rs_install_primary.sql in pdb2 database

[sybase@localhost scripts]$ isql -Usa -SPROD_ASE -irs_install_primary.sql -w9999 -e -ors_install_primary.sql.out -Dpdb2

Password:

It will create sp and tables in pdb2 which is required for replication.

5. Configure the rep agent on the pdb2 ans its primary database       <DS>

1> use pdb2

2> go

1> sp_config_rep_agent pdb2,enable,”PROD_RS”,”PROD_RS_ra”,”PROD_RS_ra_ps”

2> go

Replication Agent enabled for database ‘pdb2’. The Replication Agent thread

needs to be started using sp_start_rep_agent.

(return status = 0)

PROD_RS_ra /PROD_RS_ra_ps is the replication user and password. If there is already a rep agent you can view

your user from rs_users tables, other wise you need to create a replication user to connect with Rep Server.

6. Now create the connection to this database with log transfer on as its primary database.      <RS>

1> create connection to “PROD_ASE”.”pdb2″

2> set error class rs_sqlserver_error_class

3> set function string class rs_sqlserver_function_class

4> set username “pdb2_maint”

5> set password  “pdb2_maint_ps”

6> with log transfer on

7> go

Connection to ‘PROD_ASE.pdb2’ is created.

7. After doing the admin who_is_down in RS, you will get rep agent down.   <RS>

1> admin who_is_down

2> go

Spid     Name                 State

Info

——– ——————– —————————————-

——————————————————————————–

REP AGENT            Down

PROD_ASE.pdb2

8. Start the rep agent in primary database as below :    <DS>

1> use pdb2

2> go

1> sp_start_rep_agent ‘pdb2’

2> go

Replication Agent thread is started for database ‘pdb2’.

(return status = 0)

9. You will not be having any thread down in replication environment:  <RS>

1> admin who_is_down

2> go

Spid     Name                 State

Info

——– ——————– —————————————-

——————————————————————————–

10. Now configuration Completed, the next step is testing:

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