Replicating the database

In this simple scenario, you use database replication definitions and subscriptions to replicate the entire primary database to one or more replicate databases.

The basic steps are:

  1. Mark the primary database for replication using sp_reptostandby. For example:

    sp_reptostandby primary_db, ‘all’
    

    Notesp_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 “create database replication definition” in the Replication Server Reference Manual 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.

    See “Materialization” for syntax and usage information for using the bulk materialization method.