Replicating the Database in a Simple Scenario

Use database replication definitions and subscriptions to replicate the entire primary database to one or more replicate databases in this simple scenario.

To configure multi-path replication, see Replication Server Administration Guide Volume 2 > Performance Tuning > Multi-Path Replication > Creating Multiple Replication Paths for MSA Environments.

You can easily add syntax to this example to replicate DDL or system stored procedures.

  1. Mark the primary database for replication using sp_reptostandby. For example:
    sp_reptostandby primary_db, ‘all’
    Note: sp_reptostandby does not mark user stored procedures for replication. You must mark each user stored procedure individually using sp_setrepproc.

    See the Replication Server Heterogeneous Replication Guide for non-ASE data servers.

  2. Set the RepAgent parameter send warm standby xacts to true so that RepAgent sends system transactions and DDL to both standby and replicate databases. For example, at the primary data server, enter:
    sp_config_rep_agent primary_db,
    		‘send warm standby xacts’, ‘true’

    See the Replication Server Heterogeneous Replication Guide for non-ASE data servers.

  3. Create a database replication definition using create database replication definition at the primary Replication Server. For example:
    create database replication definition repdef_1
      with primary at PDS.primary_db

    See Replication Server Reference Manual > Replication Server Commands > create database replication definition for complete syntax and usage information.

  4. Create a database subscription for each subscribing database. In this example, we are creating a database subscription using create subscription and the no materialization method. The primary and replicate databases have been synchronized prior to subscription. You can also use create subscription if activities at the primary database can be suspended.
    For example, at the replicate Replication Server, enter:
    create subscription sub_1
      for database replication definition repdef_1
        with primary at PDS.primary_db
        with replicate at RDS.rdb
      without materialization
      subscribe to truncate table

    When creating a database subscription, you can use the no materialization method (as shown in step 4) or the bulk materialization method to synchronize databases. The procedure you use depends on which materialization method you choose and whether primary table activities can be suspended.

Related concepts
Materialization
Related tasks
Replicating DDL and System Procedures