Adding the Active Database to the Replication Server

Add the active database.

  1. Add entries for Replication Server and Adaptive Server that host the primary or active database to the corresponding interfaces files.
    Note: Restart the Adaptive Server or Replication Server if the interfaces file has changed.
  2. Go to $SYBASE/REP-15_5/init/rs.
  3. Make a copy of the setupdb.rs file and rename it as myactive.rs.
  4. Edit the myactive.rs file.
    Sample values for the myactive.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 primary database. sunak1505i
    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 primary database pubs2
    rs.rs_needs_repagent Specifies whether you plan to replicate from specified primary 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.
    Note: Do not use a user ID that has been aliased to another user ID.
    USE_DEFAULT

    The default value is databasename_maint.

    rs.rs_db_maint_password Specifies the password for the maintenance user. <database>_maint_ps
    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
    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. active
    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
  5. Save the file.
  6. Go to $SYBASE/REP-15_5/install.
  7. Create the connection from the active database to the Replication Server by running the resource file:
    ./rs_init -r ../init/rs/myactive.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 -Ssunak1505i
      use pubs2
      go
      sp_config_rep_agent pubs2,'disable'
      go

    Re-run rs_init command

  8. Validate the primary connection:
    isql -Usa -Psa_pass -SPRS
  9. 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       AwaitingMessage  sunak1505i.pubs2
    21         dSUB      Sleeping
    15         dCM       Awaiting Message
    18         dAIO      Awaiting Message
    23         dREC      Sleeping dREC
    9          dDELSEG   Awaiting Message
    29         USER      Active sa
    14         dALARM    Awaiting Wakeup
    24         dSYSAM    Sleeping
    Note: The RepAgent for the active database must be available.
  10. 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/ None None
    Controller RS Operation in Progress State of Operation in Progress Spid
    [16777317] PRS None None