http://goo.gl/EmKxy0

Archive

Posts Tagged ‘rs_init’

Sybase Replication Server: Warm Standby Setup using rs_int

May 19th, 2011 No comments

Guys,

Please find attached pdf for WS Setup using rs_init:

Sybase Replication Warm Standby Setup
In Next post we will be creating WS without rs_init, till then bbye.

Adding a Primary DB in Replication Server without rs_init

April 23rd, 2011 No comments

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 (0×0000, 0×00001428).

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:

Adding a Replicate DB in Replication Server without rs_init

April 23rd, 2011 No comments

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)