Sybase Replication Server
Step-by-step instructions to install a warm standby Replication Server
Author Amol P Ingle
Create a maintenance user on the Primary and Replicate Sybase ASE dataservers.
The maintenance user, typically
transactions at the destination dataserver.
Under normal circumstances you would not change the name and password of the
maintenance user. Ensure that these values are identical
at the source and destination. Also since the databases will be synced using a database
backup and restore, it will help to sync logins
on the primary and replicate dataservers. This can be achieved by Bcp-ing syslogins and
sysloginroles.
The following acronyms are used for various entities in the replication topology
PDB – Primary database
RDB – Replicate database
RS - Replication server
PDS – Primary Dataserver
RDS – Replicate Dataserver
It is assumed that databases
size.
STEP 1 : Create logins on PDS and RDS
isql –Usa –P
sp_addlogin "
go
grant role replication_role to "
go
-- check the value of the suid
select suser_id("
go
use
go
sp_addalias "
go
isql –Usa –P
"
go
grant role replication_role to "
go
-- check the value of the suid
select suser_id("
go
use
go
sp_addalias "
go
STEP 2 : Install the replication server stored procedures and tables
Execute the script rs_install_primary.sql located in $SYBASE/$SYBASE_REP/script in
both the PDB and RDB databases. Please comment out commands “dbcc settrunc” and
“sp_setreplicate” in the script since these need to be run after the replication agent is
configured.
isql -Usa -P
isql -Usa -P
STEP 3 : Configure ASE dataservers for replication
This step is essentially to enable rep agent threads
isql -Usa -P
sp_configure "enable rep agent threads",1
go
isql -Usa -P
sp_configure "enable rep agent threads",1
go
STEP 4 : Create logical connection on the replication server
Name of the logical connection below is
primary data source
isql -Usa -P
create logical connection to
go
STEP 5 : Create connection to the active database
isql -Usa -P
create connection to
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to
set password to
with log transfer on
as active for
go
STEP 6 : Create the maintenance login on the replication server
This login is used by the replication agent running in the ASE to connect to the
replication server.
isql -Usa -P
create user
set password
go grant connect source to
go
STEP 7 : Configure replication agent
isql -Usa -P
use
go
-- This will clear previously installed rep agents. Ho harm if none are present.
sp_config_rep_agent "
go
-- Continue installing rep agent.
sp_config_rep_agent "
"
go
sp_config_rep_agent "
go
sp_setreplicate rs_marker,"true"
go
sp_setreplicate rs_update_lastcommit,"true"
go
sp_start_rep_agent "
go
STEP 8 : Mark the database for replication
Execute the sp_reptostandby stored procedure in the primary or active ASE to activate
replication from the active database to the replication server.
isql -Usa -P
go
sp_reptostandby "
go
STEP 9 : Create connection to the standby database
isql -Usa -P
create connection to
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to
set password to
with log transfer on
as standby for
use dump marker
go
STEP 10 : Check the status of replication connections
isql -Usa -P
admin logical_status
go
This command should show the primary and standby connections active and the standby
connection awaiting “enable marker”
isql -Usa -P
admin who_is_down
go
DSI threads to
STEP 11 : Dump the primary database
isql -Usa -P
dump database
go
STEP 12 : Restore standby database from the dump
isql -Usa -P
load database
go
online database
go
STEP 13 : Resume connection to the standby database
isql -Usa -P
resume connection to
go
STEP 14 : Test replication
Test Replication Connection
isql -Usa -P
go
--create a test table
create table dummy (f1 int)
go
insert dummy select 1
go
isql -Usa -P
use
go
select * from dummy
go
f1 ----1
Sybase Replication Server Maintenance
Health Checks
The following commands are being used to check the replication system.
isql -Usa -P
>admin who_is_down
>go
isql -Usa -P
>admin health
>go
isql -Usa -P
>admin logical_status
>go
Re-Syncing the Standby Database
Sometimes it may be necessary to resync the warm standby database.
This could be due to replication errors, huge data updates in case of which it is preferred
to break replication and
restart it after the update or due to replication changes to text or image columns.
In such case the steps to resync a warmstandby database are as follows:
1>Suspend connection to
2>Drop connection to
3>Stop the replication agent on
4>Create connection to
5>Start replication agent on
6>Dump the primary database
7>Load database dump to the standby database
8>Resume connection to
These are the commands used to re-sync a standby database.
isql -Usa -P
>suspend connection to
>go
>drop connection to
>go
isql -Usa -P
>use
>go
>sp_stop_rep_agent "
>go
isql -Usa -P
>create connection to
>set error class to rs_sqlserver_error_class
>set function string class to rs_sqlserver_function_class
>set username to
>with log transfer on
>as standby for
>use dump marker
>go isql -Usa -P
>go
>sp_start_rep_agent "
isql -Usa -P
>admin logical_status
>go
--this should display Suspended/Awaiting for Enable Marker on
NOT PROCEED unless this any issues are fixed
isql -Usa -P
>dump database
>go
isql -Usa -P
>load database
>go
>online database
>go
isql -Usa -P
>resume connection to
>go
Comments
Post a Comment