Marking a stored procedure for replication

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. See “Enabling and disabling replication for DDL”.

StepsMarking a stored procedure for replication

  1. Log in to the Replication Agent instance with the administrator login.

  2. Use the pdb_setrepproc command to determine if the stored procedure is already marked in the primary database:

    pdb_setrepproc pdb_proc
    

    Here, pdb_proc is the name of the stored procedure in the primary database that you want to mark for replication.

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

    • If the pdb_setrepproc command 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, do one of the following:

    1. When the procedure in the replicate database has the same name as the procedure in the primary database, use the following command to mark a procedure for replication:

      pdb_setrepproc pdb_proc, mark
      

      Here, pdb_proc is the name of the procedure in the primary database that you want to mark for replication.

    2. When the procedure in the replicate database has a different name from the procedure in the primary database, use the following command to mark a procedure for replication:

      pdb_setrepproc pdb_proc, rep_proc, mark
      

      Here, pdb_proc is the name of the procedure in the primary database that you want to mark for replication, and rep_proc is the name of the procedure in the replicate database.

  4. If there is a function replication definition or one is to be added before replication, do one of the following regardless of whether or not there is also a database replication definition:

    1. When the function replication definition has the same name as the procedure in the primary database, use the following command to mark a procedure for replication:

      pdb_setrepproc pdb_proc, mark
      

      Here, pdb_proc is the name of the procedure in the primary database that you want to mark for replication.

      NoteIf 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’ ...
      
    2. When the name of the function replication definition is different from the procedure in the primary database, use the following command to mark a procedure for replication:

      pdb_setrepproc pdb_proc, rdpri_proc, mark
      

      Here, pdb_proc is the name of the procedure in the primary database that you want to mark for replication, and rdpri_proc is the name of the function replication definition. The function replication definition must map to the procedure in the replicate database.

      NoteIf 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. Use the pdb_setrepproc command to enable replication for the marked stored procedure:

    pdb_setrepproc pdb_proc, enable
    

    Here, pdb_proc is the name of the marked stored procedure for which you want to enable replication.

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