Marking a Stored Procedure for Replication

Mark stored procedures for replication.

Prerequisites

Before you can stored procedures for replication, you must create the Replication Agent transaction log objects.

For Oracle, DDL replication must be disabled during the marking of stored procedures. Because marking of a stored procedure modifies that stored procedure, you must first disable DDL replication to prevent the marking modifications from replicating to the replicate site.

Task
  1. Log in to the Replication Agent instance with the administrator login.
  2. Determine if replication is enabled for the stored procedure:
    pdb_setrepproc pdb_proc

    where pdb_proc is the name of the stored procedure that you want to mark for replication.

    • If pdb_setrepproc returns information that the specified stored procedure is marked, you do not need to continue this procedure

    • If pdb_setrepproc returns information that the specified stored procedure is not marked, continue this procedure to mark the stored procedure for replication.

  3. If there is no function replication definition, only a database replication definition, and no function replication definition is to be added before replication, either:
    • When the procedure in the replicate database has the same name as the procedure in the primary database, use:

      pdb_setrepproc pdb_proc, mark
    • When the procedure in the replicate database has a different name from the procedure in the primary database, use:

      pdb_setrepproc pdb_proc, rep_proc, mark

      where rep_proc is the name of the procedure in the replicate database.

  4. If there is a function replication definition, or if a replication definition is to be added before replication, do one of the following, regardless of whether or not there is also a database replication definition:
    • When the function replication definition has the same name as the procedure in the primary database, use:
      pdb_setrepproc pdb_proc, mark
      • If the procedure in the replicate database has the same name as the function replication definition, there is no need to use the deliver as clause. For example,

        create function replication definition pdb_proc
        with primary at data_server.database ...
      • If the procedure in the replicate database has a different name from the name of the function replication definition, the function replication definition must map to the procedure in the replicate database. For example,

        create function replication definition pdb_proc
        with primary at data_server.database
        deliver as ‘rep_proc’ ...
    • When the name of the function replication definition is different from the procedure in the primary database, use:
      pdb_setrepproc pdb_proc, rdpri_proc, mark

      where rdpri_proc is the name of the function replication definition. The function replication definition must map to the procedure in the replicate database.

      • If the procedure in the replicate database has the same name as the function replication definition, there is no need to use the deliver as clause. For example,

        create function replication definition rdpri_proc
        with primary at data_server.database ...
      • If the procedure in the replicate database has a different name from the function replication definition, the function replication definition must map to the procedure in the replicate database. For example,

        create function replication definition rdpri_proc
        with primary at data_server.database
        deliver as ‘rep_proc’ ...
  5. Enable replication for the marked stored procedure:
    pdb_setrepproc pdb_proc, enable

    After replication is enabled for the stored procedure, you can begin replicating invocations of that stored procedure in the primary database.

    Note: If your stored procedure is in Oracle and you disabled DDL replication during stored procedure marking, remember to reenable DDL replication. Because marking a stored procedure modifies it, you must first disable DDL replication to prevent the marking modifications from replicating to the standby site.
Related concepts
Enabling and Disabling DDL Replication