Adding the Standby Database to the Replication Server

Add the standby database. The example procedure for configuring warm standby uses a dump of the active database to load the standby database and starts replication after the setup is complete.

  1. Add entries for Replication Server and Adaptive Server that host the replicate database to the corresponding interfaces files.
    Note: Restart the Adaptive Server and Replication Server if the interfaces file has changed.
  2. Add the maintenance user login name for the standby connection in the standby data server.
  3. Go to $SYBASE/REP-15_5/init/rs.
  4. Make a copy of the setupdb.rs file and rename it as mystandby.rs.
  5. Edit the mystandby.rs file.
    Sample Values for the mystandby.rs File
    Parameter Description Value
    sybinit.release_directory Specifies the valid path of the Replication Server software ($SYBASE). /opt/sybase
    rs.rs_name Specifies the name of the Replication Server PRS
    rs.rs_rs_sa_user Specifies the user ID that has “sa” privileges on Replication Server. sa
    rs.rs_rs_sa_pass Specifies the password of the “sa” user. sa_pass
    rs.rs_ds_name The name of the data server that hosts the standby database. wingak1505i
    rs.rs_ds_sa_user Specifies the user ID that has “sa” privileges on data server. sa
    rs.rs_ds_sa_password Specifies the password of the “sa” user for the data server. password
    rs.rs_db_name Specifies the name of the standby database pubs2
    rs.rs_needs_repagent Specifies whether you plan to replicate from specified standby database. yes
    rs.rs_db_maint_user Specifies the user ID that performs insert, update, delete, and truncate table commands to the replicate database. The user ID must have permissions to perform DML commands at the replicate database. The user is called maintenance user. The maintenance user (rs.rs_db_maint_user) that was defined for the active database. Using the same user for the active and standby database simplifies synchronizing the server user IDs after the database dump is loaded to the standby server.
    rs.rs_db_maint_password Specifies the password for the maintenance user. The password for the user specified rs.rs_db_maint_user
    rs.rs_ltm_rs_user The user that the Replication Agent will use to log into the Replication Server.  The name must exist.  This name typically comes from values that were set up during RS creation time:  rs.rs_ltm_rs_user. PRS_ra
    rs.rs_ltm_rs_pass Specifies the password of the login entered in the rs.rs_ltm_rs_user parameter. PRS_ra_ps
    Warning!  When creating the replicate connection, comment out the line for this parameter. Otherwise, the resource file will not work.
    rs.rs_db_physical_for_logical Specifies whether this is a warm standby database. yes
    rs.rs_db_active_or_standby Specifies whether the configuration is for active or standby database. standby
    rs.rs_db_logical_ds_name Specifies the data server portion of the logical connection name. pubs2a
    rs.rs_db_logical_db_name Specifies the database portion of the logical connection name. pubs2s
    rs.rs_db_active_ds_name Specifies the server that hosts the standby database. sunak1505i
    rs.rs_db_active_db_name Specifies the name of the active database. pubs2
    rs.rs_db_active_sa Specifies the user ID that has “sa” privileges on the active database. sa
    rs.rs_db_active_sa_pw Specifies the password of the “sa” user. password
    rs.rs_init_by_dump Specifies that the standby database is initialized using a dump of the active database. yes
    rs.rs_db_use_dmp_marker Specifies that “dump marker” option is used to notify replication when to begin forwarding transactions to the standby database. yes
  6. Save the file.
  7. Go to $SYBASE/$SYBASE_REP/install.
  8. Create the connection from the Replication Server to the standby database by running the resource file:
    ./rs_init -r ../init/rs/mystandby.rs

    If the rs_init command fails, correct the issue, then disable the RepAgent as follows:

    1. Log in to the primary Adaptive Server using an “sa” user role and access the primary database.
    2. Disable the RepAgent thread in the primary database:
      isql -Usa -P -Swingak1505i 
      use pubs2 
      go
      sp_config_rep_agent pubs2,'disable'
      go

    Re-run rs_init command

  9. Validate the replicate or standby connection:
    isql -Usa -Psa_pass -SPRS
  10. Enter:
    admin who
    go
    The output generated from admin who is similar to
    Spid    Name       State               Info
    ------  -------    ------------        -----------------
    36      DIST       Awaiting Wakeup     102 pubs2a.pubs2s
    37      SQT        Awaiting Wakeup     102:1 DIST pubs2a.pubs2s
    31      SQM        Awaiting Message    102:1 pubs2a.pubs2s
    30      SQM        Awaiting Message    102:0 pubs2a.pubs2s
    27      DSI EXEC   Awaiting Command    101(1)sunak1505i.PRS_RSSD
    20      DSI        Awaiting Message    101 sunak1505i.PRS_RSSD
    26      SQM        Awaiting Message    101:0 sunak1505i.PRS_RSSD
    49      DSI EXEC   Awaiting Command    103(1)sunak1505i.pubs2
    35      DSI        Awaiting Message    103 sunak1505i.pubs2
    38      REP AGENT  Awaiting Command    sunak1505i.pubs2
    39      NRM        Awaiting Message    sunask1505i.pubs2
            DSI EXEC   Suspended           104(1)wingak1505i.pubs2
            DSI        Suspended           104 wingak1505i.pubs2
    21      dSUB       Sleeping
    15      dCM        Awaiting Message
    18      dAIO       Awaiting Message
    23      dREC       Sleeping dREC
    9       dDELSEG    Awaiting Message
    29      USER       Awaiting Command    sa
    55      USER       Active              sa
    14      dALARM     Awaiting Wakeup
    24      dSYSAM     Sleeping
    Note: The RepAgent for the active database must be available.
  11. Validate the status of the active database connection:
    admin logical_status
    go

    The output generated from admin logical_status is similar to:

    Logical Connection Name Active Connection Name Active Conn State Standby Connection Name Standby Conn State
    [102] pubs2a.pubs2s [103] sunak1505i.pubs2 Active/ [104] wingak1505i.pubs2 Suspended /Waiting for Enable Marker
    Controller RS Operation in Progress State of Operation in Progress Spid
    [16777317] PRS None None  
  12. Exit the isql session