Task Three: Enabling Replication for Objects in the Active Database

Use sp_reptostandby to enable replication of stored procedures, and sp_reptostandby or sp_setreptable to enable replication for tables in the active database.

You can enable replication for tables in the active database in either of two ways:
  • sp_reptostandby to mark the database for replication, enabling replication of data and supported schema changes.

  • sp_setreptable to mark individual tables for replication of data changes.

  1. Log in to the Adaptive Server as the system administrator or as the database owner, and execute:
    use active_database
  2. Mark database tables for replication, using one of three methods.
    • Mark all user tables by executing the sp_reptostandby system procedure:
      sp_reptostandby dbname, [ 'L1' | 'all' ]

      where dbname is the name of the active database, L1 sets the replication level to that of Adaptive Server version 11.5, and all sets the replication level to the current version of Adaptive Server. This method replicates both DML and DDL commands and procedures.

    • Mark all user tables by executing sp_reptostandby with the use_index option:
      sp_reptostandby dbname, [[, 'L1' | 'ALL'][, use_index]]

      where dbname is the name of the active database. With the use_index option, the database is marked to use indexes on text, unitext, image, or rawobject columns, and internal indexes are created on those tables not explicitly marked for replication.

    • Mark individual user tables for replication of data changes by executing the sp_setreptable system procedure for each table that you want to replicate into the standby database:
      sp_setreptable table_name, 'true'

      where table_name is the name of the table. This method replicates DML commands.

  3. Execute sp_setrepproc with the relevant parameter for every stored procedure which has executions you want to replicate into the standby database.
    • If you are using the replicated functions feature described in Replication Server Administration Guide Volume 1 > Manage Replicated Functions, execute sp_setrepproc with the 'function' parameter:
      sp_setrepproc proc_name, 'function'
    • If you are using asynchronous procedures such as replicated stored procedures associated with table replication definitions, execute sp_setrepproc with the 'table' parameter:
      sp_setrepproc proc_name, 'function'
Related concepts
Replicated Information for Warm Standby
Asynchronous Procedures