Nupur Sharma Nupur Sharma

How to Refresh or Resync a replicated database using Sybase ASE and Replication Server

This is just one way to resync the replicated database in Sybase

Stop Replication

log into primary server and change database

sp_stop_rep_agent <DBNAME>

dbcc settrunc(ltm, ignore)

log into repserver

suspend connection to <secondary_dbserver>.<dbname>

Flush queue

Check disk space on the RepServerlog into RepServer

admin disk_space

log into RSSD database (typically on the standby Sybase ASE)

run rs_helppartition “partition name” to determine which queues this partition contains

If we are going to resync, we need to flush the queue (in the RepServer)

sysadmin hibernate_on, “Reason for flushing queue”

sysadmin sqm_purge_queue, <connection #>, 0

sysadmin sqm_purge_queue, <connection #>, 1

sysadmin sqm_purge_queue, 140, 0   (“0” is the outbound queue.  “1” is the inbound queue) – do for both queues

sysadmin hibernate_off, “Reason for flushing queue”

Sync databases

log into RSSD database

rs_zeroltm <primary_server>.<dbname>

turn secondary truncation marker in primary server.dbname

dbcc settrunc(ltm, valid)

dump database on primary server

sp_start_rep_agent <dbname>

this will transfer the transactions from the primary database’s log segment into the queues.

load database on secondary server (do not bring on line)

dbcc dbrepair(<dbname>, ‘ltmignore’)

online database <dbname>

Enable Replication

log into rep server

resume connection to <secondary_dbserver>.<dbname>

if the replication definitions are for individual tables and not the entire database

set autocorrection on for <table_repdef> with replicate at <secondary_dbserver>.<dbname>

when the tables are in sync, turn off autocorrection (replace ‘on’ with ‘off’)

if the replication definition is for the entire database

be prepared to run “resume connection to <secondary_dbserver>.<dbname> skip transaction” until the databases are in sync – can be quite a few (this can be scripted if necessary).

Nupur Sharma

Nupur Sharma Creator

DBA in IBM working towards sharing some knowledge ...

Suggested Creators

Nupur Sharma