Skip to main content

Installation of warm standby Replication Server


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 _maint, is used to server to apply replicated
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 .and . exist and are the same
size.
STEP 1 : Create logins on PDS and RDS
isql –Usa –P -S
sp_addlogin "",""
go
grant role replication_role to ""
go
-- check the value of the suid
select suser_id("")
go
use
go
sp_addalias "","dbo"
go
isql –Usa –P -S sp_addlogin
"",""
go
grant role replication_role to ""
go
-- check the value of the suid
select suser_id("")
go
use
go
sp_addalias "","dbo"
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 -S –D -i rs_install_primary.sql
isql -Usa -P -S –D -i rs_install_primary.sql
STEP 3 : Configure ASE dataservers for replication
This step is essentially to enable rep agent threads
isql -Usa -P -S
sp_configure "enable rep agent threads",1
go
isql -Usa -P -S
sp_configure "enable rep agent threads",1
go
STEP 4 : Create logical connection on the replication server
Name of the logical connection below is . and but refers to the current
primary data source
isql -Usa -P -S_rs
create logical connection to .
go
STEP 5 : Create connection to the active database
isql -Usa -P -S
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 -S
create user
set password
go grant connect source to
go
STEP 7 : Configure replication agent
isql -Usa -P -S
use
go
-- This will clear previously installed rep agents. Ho harm if none are present.
sp_config_rep_agent "", "disable"
go
-- Continue installing rep agent.
sp_config_rep_agent "", "enable", "_rs", "",
""
go
sp_config_rep_agent "", "send warm standby xacts", true
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 -S use
go
sp_reptostandby "","all"
go
STEP 9 : Create connection to the standby database
isql -Usa -P -S_rs
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 -S_rs
admin logical_status
go
This command should show the primary and standby connections active and the standby
connection awaiting “enable marker”
isql -Usa -P -S_rs
admin who_is_down
go
DSI threads to . should be DOWN.
STEP 11 : Dump the primary database
isql -Usa -P -S
dump database to ""
go
STEP 12 : Restore standby database from the dump
isql -Usa -P -S
load database from ""
go
online database
go
STEP 13 : Resume connection to the standby database
isql -Usa -P -S_rs
resume connection to .
go
STEP 14 : Test replication
Test Replication Connection
isql -Usa -P -S use
go
--create a test table
create table dummy (f1 int)
go
insert dummy select 1
go
isql -Usa -P -S
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 -S
>admin who_is_down
>go
isql -Usa -P -S
>admin health
>go
isql -Usa -P -S
>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 with dump marker
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 -S
>suspend connection to .
>go
>drop connection to .
>go
isql -Usa -P -S
>use
>go
>sp_stop_rep_agent ""
>go
isql -Usa -P -S
>create connection to .
>set error class to rs_sqlserver_error_class
>set function string class to rs_sqlserver_function_class
>set username to _rep set password to
>with log transfer on
>as standby for .
>use dump marker
>go isql -Usa -P -S >use
>go
>sp_start_rep_agent ">go
isql -Usa -P -S
>admin logical_status
>go
--this should display Suspended/Awaiting for Enable Marker on .. DO
NOT PROCEED unless this any issues are fixed
isql -Usa -P -S
>dump database to ""
>go
isql -Usa -P -S
>load database from ""
>go
>online database
>go
isql -Usa -P -S
>resume connection to .
>go

Comments

Popular posts from this blog

Replication Server Quick Ref Guide

Replication Server Guide : • Replication Server Commands • ASE commands and system stored procedures • ASE RSSD stored procedures • RSSD tables • Replication Server System Functions • Troubleshooting Tips Abbreviations Some abbreviations which are used in this Quick Reference Guide: ASE Adaptive Server Enterprise DSI DataServer Interface - RS thread for a connection to a replicate database DIST Distributor - RS thread per primary database LTM Log Transfer Manager; synonym for RepAgent RS, RepServer Replication Server RepAgent Replication Agent (in primary dataserver) RepDef Replication Definition RSI Replication Server Interface - RS thread related to a route to another RepServer RSM Replication Server Manager (a DBA tool normally used in combination with Sybase Central) RSSD Replication Server System Database SQM Stable Queue Manager - RS thread managing a queue SQT Stable Queue Manager - RS thread assembling transactions Replication Server Commands The following commands can only be ...

Sybase IQ material - Quick Ref

Contents IQ 12.6 Commands IQ 12.6 Datatypes IQ 12.6 Functions IQ 12.6 System Procedures IQ 12.6 Catalogue Procedures IQ 12.6 Multiplex System Procedures IQ 12.6 ASE Compatibility System Procedures IQ 12.6 ASE Compatibility Catalogue Procedures IQ 12.6 Extended Procedures IQ 12.6 General Database Options IQ 12.6 T-SQL Compatibility Options IQ 12.6 DBISL Options IQ 12.6 Server Properties IQ 12.6 Database Properties IQ 12.6 Commands Two styles of commenting; the same as in ASE :- /* a comment between delimiters on one or more lines */ -- a comment until the end of this line ALLOCATE DESCRIPTOR descriptor-name [ WITH MAX { integer | host-variable } ] ^ALTER DBSPACE dbspace-name { READWRITE | READONLY | RELOCATE | SIZE dbspace-size [ KB | MB | GB | TB | PAGES ] | ADD dbspace-size [ KB | MB | GB | TB | PAGES ] } ALTER EVENT event-name [ DELETE TYPE | TYPE event-type ] { WHERE { trigger-condition | NULL } | { ADD | [ MODIFY ] | DELETE } SCHEDULE schedule-spec } [ ENABLE | DISABLE ] [ [ MODIFY...

Interesting Notes on ASE

Some hidden things about ASE Different States of SLEEP When all processes are shown as SLEEPING by sp_who except the one, which issued the sp_who command, how can a user tell the difference between hangings versus running processes? Definitions In pre-4.9.2 SQL Servers, the output of sp_who could be difficult to interpret. Processes showed only one type of SLEEP status, "sleeping". In System 10, and 4.9.2 Rollup 2115 and above, sp_who shows four types of sleep along with the other possible statuses: Value Meaning Infected The server erred with a stack trace, and the process got an error that would normally kill it. The process is infected instead of killed. Background This process is in the background recv sleep The process is waiting for input from the client Send sleep The process is waiting for a write to the client to complete alarm sleep The process is waiting for an alarm (usually means the process is waiting for a wait for command to complete). Lock sleep The process i...