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 Mirror Replication Agent user.

  3. Create the database replication definition.

  4. Create the database replication subscription.

StepsConfiguring 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 to $SYBASE/MA-15_2/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. Change these values in the newly created script and save the script:

    • $SYBASE – enter the path name of the $SYBASE where the Replication Server resides, for example, /software/sybase. ($SYBASE occurs three times in the script).

    • $SYBASE_REP – enter REP-15_2.

    • pds – name of the ASE data server where the primary database resides.

    • pdb – name of the primary database.

    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. 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) repit152i2.foo2
    
    27   DSI        Awaiting Message  102 repit152i2.foo2
    
    26   SQM        Awaiting Message  102:0 repit152i2.foo2
    
    38   DSI EXEC   Awaiting Command  103(1) repit152i.foo
    
    33   DSI        Awaiting Message  103 repit152i.foo
    
    35   DIST       Awaiting Wakeup   103 repit152i.foo
    
    36   SQT        Awaiting Wakeup   103:1 DIST repit152i.foo
    
    34   SQM        Awaiting Wakeup   103:1 repit152i.foo
    
    32   SQL        Awaiting Message  103:0 repit152i.foo
    
    37   REP AGENT  Awaiting Command  repit152i.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, repit152i.foo is the primary database, it has a Mirror Replication Agent thread, and repit152i2.foo2 is the standby database. All threads for the primary and standby databases should have the Awaiting Message or Awaiting Command state.

StepsGranting create object permission to the Mirror Replication Agent user

  1. Allow the default Mirror 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_2/init/ase.rs) that you use for the rs_username configuration parameter.

  2. Exit isql.

StepsCreating the database replication definition

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

    cd $SYBASE/MA-15_2/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:

    • pds is the name of the data server where the primary database resides.

    • pdb is the name of the primary database.

    For example:

    repit152i.foo
    

    Here is a database replication definition example:

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

    isql -Usa -P –SSAMPLE_RS -imyma_create_rs_db_repdef.sql
    

    A message appears, indicating that the database replication definition has been created.

StepsCreating 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. 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 repit152i_sub1
    
    for database replication definition
    
    repit152i_repdef1
    
    with primary at repit152i.foo
    
    with replicate at repit152i2.foo2
    
    without materialization
    
  3. Execute the script in Replication Server:

    isql -Usa -P -SSAMPLE_RS -imymra_create_rs_db_sub.sql
    

    A message appears, indicating that the subscription is being created.