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

Stop Replication

  1. log into primary server and change database
    1. sp_stop_rep_agent <DBNAME>
    2. dbcc settrunc(ltm, ignore)
  2. log into repserver
    1. suspend connection to <secondary_dbserver>.<dbname>

Flush queue

  1. Check disk space on the RepServer
    1. log into RepServer
      1. admin disk_space
    2. log into RSSD database (typically on the standby Sybase ASE)
      1. run rs_helppartition “partition name” to determine which queues this partition contains
  2. If we are going to resync, we need to flush the queue (in the RepServer)
    1. sysadmin hibernate_on, “Reason for flushing queue”
    2. sysadmin sqm_purge_queue, <connection #>, 0
    3. sysadmin sqm_purge_queue, <connection #>, 1
      1. sysadmin sqm_purge_queue, 140, 0   (“0″ is the outbound queue.  “1″ is the inbound queue) – do for both queues
    4. sysadmin hibernate_off, “Reason for flushing queue”

Sync databases

  1. log into RSSD database
    1. rs_zeroltm <primary_server>.<dbname>
  2. turn secondary truncation marker in primary server.dbname
    1. dbcc settrunc(ltm, valid)
  3. dump database on primary server
  4. sp_start_rep_agent <dbname>
    1. this will transfer the transactions from the primary database’s log segment into the queues.
  5. load database on secondary server (do not bring on line)
    1. dbcc dbrepair(<dbname>, ‘ltmignore’)
    2. online database <dbname>

Enable Replication

  1. log into rep server
    1. resume connection to <secondary_dbserver>.<dbname>
  2. if the replication definitions are for individual tables and not the entire database
    1. set autocorrection on for <table_repdef> with replicate at <secondary_dbserver>.<dbname>
    2. when the tables are in sync, turn off autocorrection (replace ‘on’ with ‘off’)
  3. if the replication definition is for the entire database
    1. 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).

« »