Configure Replication Server for replication from the primary database

This section describes these configuration steps required for replication from the primary database:

  1. Configure Replication Server for replication from the primary database.

  2. Grant create object permission to the Replication Agent user.

  3. Create the database replication definition.

  4. Create the database replication subscription.

StepsTo configure Replication Server for replication from the primary database

  1. If needed, add the primary ASE server to the interfaces file of the Replication Server and reboot the Replication Server.

  2. Change the directory to $SYBASE/MA-15_0/scripts/ase.

  3. Make a copy of ase_create_rs_primary_connection.rs:

    cp ase_create_rs_primary_connection.rs myma_ase_create_rs_primary_connection.rs
    
  4. Using a text editor, change these values in the newly created script and save the script:

    Note

    • If you are not using the SAMPLE_RS, change the SAMPLE_RS to the proper Replication Server name.

    • The value entered for rs.rs_ds_name and rs.rs_name must exist in the interfaces file used by the Replication Server, and the names are case sensitive.

  5. Using the rs_init utility in Replication Server, create the connection from the Replication Server to the primary database:

    $SYBASE/$SYBASE_REP/install/rs_init -r myma_ase_create_rs_primary_connection.rs
    

    The connection to the primary database is created.

  6. Verify that the connections to the primary and standby servers have been made:

    isql -Usa -P -SSAMPLE_RS
    admin who
    go
    
    Spid Name       State                Info                                      ---- ---------- -------------------- ---------------------------------    23 DSI EXEC   Awaiting Command   101(1)SAMPLE_RS_ERSSD.SAMPLE_RS_ERSSD      19 DSI        Awaiting Message    101 SAMPLE_RS_ERSSD.SAMPLE_RS_ERSSD         18 SQM        Awaiting Message     101:0 SAMPLE_RS_ERSSD.SAMPLE_RS_ERSSD       28 DSI EXEC   Awaiting Command    102(1) repit150i2.foo2                      27 DSI        Awaiting Message     102 repit150i2.foo2                         26 SQM        Awaiting Message     102:0 repit150i2.foo2                       38 DSI EXEC   Awaiting Command     103(1) repit150i.foo                        33 DSI        Awaiting Message     103 repit150i.foo                           35 DIST       Awaiting Wakeup      103 repit150i.foo                           36 SQT        Awaiting Wakeup      103:1  DIST repit150i.foo                   34 SQM        Awaiting Wakeup      103:1 repit150i.foo                         32 SQM        Awaiting Message     103:0 repit150i.foo                         37 REP AGENT  Awaiting Command     repit150i.foo                               20 dSUB       Sleeping                                                         15 dCM        Awaiting Message                                                 17 dAIO       Awaiting Message                                                 21 dREC       Sleeping             dREC                                        39 USER       Active               sa                                          14 dALARM     Awaiting Wakeup                                                  22 dSYSAM     Sleeping 
    

    In this example, repit150i.foo is the primary database, it has a Replication Agent thread, and repit150i2.foo2 is the standby database. All threads for the primary and standby databases should have the “Awaiting Message” or “Awaiting Command” state.

StepsTo grant create object permission to the Replication Agent user

  1. Allow the default Replication Agent user to create replication definitions:

    grant create object to SAMPLE_RS_ra 
    go
    

    Permission is granted to user “SAMPLE_RS_ra.”

    NoteCreate object permissions must be granted to the value (located in $SYBASE/MA-15_0/init/ase.rs) that you use for the rs_username configuration parameter.

  2. Exit isql.

StepsTo create the database replication definition

  1. Go to the $SYBASE/MA-15_0/scripts/sybase directory:

    cd $SYBASE/MA-15_0/scripts/sybase
    
  2. Make a copy of the create_rs_db_repdef.sql directory:

    cp create_rs_db_repdef.sql myma_create_rs_db_repdef.sql
    
  3. Before executing the myma_create_rs_db_repdef.sql script, change the value of “{pds}.{pdb}” to the name of the connection string you defined for the primary database, where:

    For example:

    repit150i.foo
    

    Here is a database replication definition example:

    create database replication definition repit150i_repdef1
    with primary at repit150i.foo
    replicate DDL
    go
    
  4. Execute the script in Replication Server:

    isql -Usa -P –SSAMPLE_RS -i myma_create_rs_db_repdef.sql
    

    A message appears indicating that the database replication definition is created.

StepsTo create the database replication subscription

  1. Make a copy of create_rs_db_sub.sql:

    cp create_rs_db_sub.sql myma_create_rs_db_sub.sql
    
  2. Using a text editor, change these values in the copied script and save the changes: {pds} – name of the data server where the primary database resides {pdb} – name of the primary database {rds} – name of the data server where the standby database resides {rdb} – name of the standby database

    Here is a create database replication subscription example:

    create subscription repit150i_sub1
       for database replication definition repit150i_repdef1
       with primary at repit150i.foo
       with replicate at repit150i2.foo2
       without materialization
    
  3. Execute the script in Replication Server:

    isql -Usa -P -SSAMPLE_RS -i mymra_create_rs_db_sub.sql
    

    A message appears indicating that the subscription is being created.