This section describes these configuration steps required for replication from the primary database:
Configure Replication Server for replication from the primary database.
Grant create object permission to the Replication Agent user.
Create the database replication definition.
Create the database replication subscription.
To configure Replication Server for replication
from the primary database
If needed, add the primary ASE server to the interfaces file of the Replication Server and reboot the Replication Server.
Change the directory to $SYBASE/MA-15_0/scripts/ase.
Make a copy of ase_create_rs_primary_connection.rs:
cp ase_create_rs_primary_connection.rs myma_ase_create_rs_primary_connection.rs
Using a text editor, 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_0.
pds – name of the ASE data server where the primary database resides.
pdb – name of the primary database.
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.
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.
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.
To grant create object permission
to the Replication Agent user
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.”
Create 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.
Exit isql.
To create the database replication definition
Go to the $SYBASE/MA-15_0/scripts/sybase directory:
cd $SYBASE/MA-15_0/scripts/sybase
Make a copy of the create_rs_db_repdef.sql directory:
cp create_rs_db_repdef.sql myma_create_rs_db_repdef.sql
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:
repit150i.foo
Here is a database replication definition example:
create database replication definition repit150i_repdef1 with primary at repit150i.foo replicate DDL go
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.
To create the database replication subscription
Make a copy of create_rs_db_sub.sql:
cp create_rs_db_sub.sql myma_create_rs_db_sub.sql
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
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.