Sybase Replication Server Step-by-step instructions to install a warm standby Replication Server 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<sa_password> -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<sa_password> -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<sa_password> -S –D -i rs_install_primary.sql isql -Usa -P<sa_password> -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<sa_password> -S sp_configure "enable rep agent threads",1 go isql -Usa -P<sa_password> -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<sa_password> -S_rs create logical connection to . go
STEP 5 : Create connection to the active database isql -Usa -P<sa_password> -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<sa_password> -S create user set password go grant connect source to go
STEP 7 : Configure replication agent isql -Usa -P<sa_password> -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<sa_password> -S use go sp_reptostandby "","all" go
STEP 9 : Create connection to the standby database isql -Usa -P<sa_password> -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<sa_password> -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<sa_password> -S_rs admin who_is_down go DSI threads to . should be DOWN.
STEP 11 : Dump the primary database isql -Usa -P<sa_password> -S dump database to "" go
STEP 12 : Restore standby database from the dump isql -Usa -P<sa_password> -S load database from "" go online database go
STEP 13 : Resume connection to the standby database isql -Usa -P<sa_password> -S_rs resume connection to . go
STEP 14 : Test replication Test Replication Connection isql -Usa -P<sa_password> -S use go --create a test table create table dummy (f1 int) go insert dummy select 1 go isql -Usa -P<sa_password> -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<sa_password> -S >admin who_is_down >go.
isql -Usa -P<sa_password> -S >admin health >go isql -Usa -P<sa_password> -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:
•
Suspend connection to
•
Drop connection to
•
Stop the replication agent on
•
Create connection to with dump marker
•
Start replication agent on
•
Dump the primary database
•
Load database dump to the standby database
•
Resume connection to
These are the commands used to re-sync a standby database. isql -Usa -P<sa_password> -S >suspend connection to . >go >drop connection to . >go isql -Usa -P<sa_password> -S<priamary_server> >use >go
>sp_stop_rep_agent "" >go isql -Usa -P<sa_password> -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 <password> >with log transfer on >as standby for . >use dump marker >go isql -Usa -P<sa_password> -S >use >go >sp_start_rep_agent "go isql -Usa -P<sa_password> -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<sa_password> -S >dump database to "" >go isql -Usa -P<sa_password> -S >load database from "" >go >online database >go isql -Usa -P<sa_password> -S >resume connection to . >go
~ good luck ~