pdb_setreptable

Returns replication marking status; marks all user tables or a specified table for replication; unmarks all marked tables or a specified table; or enables or disables replication for all marked tables or a specified table.

Syntax

For Oracle and Microsoft SQL Server:
pdb_setreptable
  [ { tablename[, [repname,] { mark [ { , immediate
                                        | , owner[, force] } ]
                               | unmark[, force]
                               | enable
                               | disable}]
    | all, { mark
           | unmark[, force]
           | enable
           | disable }
  } ]
For IBM DB2 UDB:
pdb_setreptable
  [ { tablename[, [repname,] { mark [ , owner[, force] ]
                               | unmark[, force]
                               | enable
                               | disable }]
    | all, { mark
           | unmark[, force]
           | enable
           | disable }
  } ]
To return replication marking status:
pdb_setreptable tablename
To mark all user tables:
pdb_setreptable all, mark
To unmark, enable, or disable all marked tables:
pdb_setreptable all, {unmark[, force]|enable|disable}
To mark, unmark, enable, or disable a specified table:
pdb_setreptable tablename, {mark[, owner][, force] |
 unmark[, force] |enable|disable}
To mark a specified table for replication with a replicated name:
pdb_setreptable tablename, repname, mark[, owner][, force]
To mark a specified table for replication immediately for any occurrence, that may or may not be marked:
pdb_setreptable tablename, mark[, immediate]
To return a list of all marked tables:
pdb_setreptable

Parameters

Examples

Usage

Using No Options
  • When pdb_setreptable is invoked with no option, Replication Agent returns a list of all marked tables in the primary database.

  • Tables marked for replication are listed in the marked objects table. All other user tables are considered unmarked.

    Note: The Replication Agent transaction log tables and shadow tables are not included in the list of unmarked tables. Also not included are any synonyms, views, or aliases of these database objects.

    For tables listed as unmarked or disabled, transactions will not be captured for replication.

Marking Tables
  • When a table is marked for replication and the owner mode is set to on, the replication definition must contain the owner name in the with primary table named clause, or the with all tables named clause. If the owner mode setting and the existence of the owner name in the replication definition do not match, the replication definition is not used.

    For example:
    • Issuing pdb_setreptable with the owner mode set to on:
      pdb_setreptable “mytable”, mark, owner
      causes the rs_create_repdef command to generate this replication definition for the primary and replicate database, which Replication Server expects to receive:
      create replication definition ra$0xda_”mytable”
      with primary at ora102.dco
      with primary table named “qa4user”.”mytable”
      with replicate table named “qa4user”.”mytable”
      .
      .
      .
    • Issuing pdb_setreptable with the owner mode set to off:
      pdb_setreptable “mytable”, mark
      causes the rs_create_repdef command to generate this replication definition for the primary and replicate database, which Replication Server expects to receive:
      create replication definition ra$0xda_”mytable”
      with primary at ora102.dco
      with primary table named ”mytable”
      with replicate table named “qa4user”.”mytable”
      .
      .
      .
  • (IBM DB2 UDB only) For a marked table, you must unmark the table before you rename or drop it.

  • When a marked table is renamed or dropped and a new table with the original name is created, you must explicitly mark the new table because the new table has no marking-related information from the original table. The marking information is maintained internally by object ID, not table name.

  • If you create a new table using a table name that was previously marked you must mark the new table by executing the pdb_setreptable command with the mark option, even if you did not unmark the previous table.

Unmarking Tables
  • When you use the unmark keyword to remove replication marking from a primary table, Replication Agent verifies that replication is disabled for that table and checks to make sure that there are no pending (unprocessed) operations for that table in the transaction log. If replication is not disabled, or there is a pending operation for that table in the transaction log, pdb_setreptable returns an error.

  • When you use the unmark keyword to remove replication marking from primary tables, you can also specify the force keyword to immediately remove replication marking from primary tables, without regard to whether replication is disabled.

Keywords
  • When multiple keywords and options are specified, each must be separated by a comma. Blank space before or after a comma is optional. For example:
    pdb_setreptable all, unmark, force
  • If a table name in the primary database is the same as a keyword, it can be identified by adding the table=string to the beginning of the name. For example:
    pdb_setreptable table=unmark, mark
    This is true for both primary table names and replicated names.
Action Keywords
  • When pdb_setreptable is invoked with a valid user table name, followed by an action keyword (mark, unmark, enable, or disable), the action specified is applied to the specified table.
  • If pdb_setreptable is invoked with a table name and the mark keyword, it marks the specified table in the primary database for replication.

    Note: When an individual table is marked, the owner filter list is not checked. This allows users to mark a table that has an owner in the owner filter list.
  • If pdb_setreptable is invoked with a table name and the unmark keyword, it removes replication marking from the specified table in the primary database.

    You can specify the force keyword after the unmark keyword to force immediate unmarking of the specified table, to unmark a table for which replication is still enabled, or to force the script execution to ignore errors and continue an unmarking operation that failed previously.

  • If pdb_setreptable is invoked with a table name and the enable keyword, it enables replication for the specified marked table in the primary database.

  • If pdb_setreptable is invoked with a table name and the disable keyword, it disables replication for the specified marked table in the primary database.

    If the disable script execution encounters a fatal error on any database object, the pdb_setreptable command returns this message:
    Could not disable the following objects: ... 
    See error log for details.
The all Keyword
  • When pdb_setreptable is invoked with the all keyword and an action keyword (mark, unmark, enable, or disable), the action specified is applied to either all tables in the primary database, or all marked tables in the primary database.

  • If pdb_setreptable is invoked with the all and mark keywords, all user tables in the primary database are marked for replication.

    Note: Tables owned by users contained in the owner filter list will not be marked. However, you will be able to mark any individual table.
  • If pdb_setreptable is invoked with the all and unmark keywords, it removes replication marking from all marked tables in the primary database.

    You can specify the force keyword after the unmark keyword to force immediate unmarking of all marked tables, or to unmark tables for which replication is still enabled, or to force the script execution to ignore errors and continue an unmarking operation that failed previously.

  • If pdb_setreptable is invoked with the all and enable keywords, it enables replication for all marked tables in the primary database.

  • If pdb_setreptable is invoked with the all and disable keywords, it disables replication for all marked tables in the primary database.

Replication Definition Types
  • How you use the pdb_setreptable command depends on the type of replication definition that you have created at Replication Server. If you have created a database replication definition with no table replication definition, then the replicate procedure in the pdb_setreptable command refers to the table in the replicate database. However, if you have created a table replication definition, then the replicate table in the pdb_setreptable command refers to the name of the table replication definition, and it is the table replication definition that must map to the table in the replicate database.

  • If no table replication definition exists and will not be added prior to replication, but only a database replication definition exists, use these commands to mark a table for replication.
    • When the table in the replicate database has the same name as the table in the primary database, use:

      pdb_setreptable pdb_table, mark

      where pdb_table is the name of the table in the primary database that you want to mark for replication.

    • When the table in the replicate database has the different name than the table in the primary database, use:

      pdb_setreptable pdb_table, rep_table, mark

      where rep_table is the name of the table in the replicate database.

  • If a table replication definition exists or will be added prior to replication, regardless of whether or not a database replication definition exists, use these commands to mark a table for replication:
    • When the primary table in the table definition has the same name as the table in the primary database:

      pdb_setreptable pdb_table, mark
      If the table in the replicate database also has the same name as the table replication definition, then you can use the with all tables named clause in the replication definition in the primary Replication Server. For example:
      create replication definition my_table_repdef with primary at data_server.database
      with all tables named pdb_table
      If the table in the replicate database has a different name than the primary table in the table replication definition, then the table replication definition must map to the table in the replicate database. For example:
      create replication definition my_table_repdef with primary at data_server.database
      with primary table named pdb_table 
      with replicate table name rep_table
    • When the name of the table replication definition is different than the table in the primary database, use:

      pdb_setreptable pdb_table, rdpri_table, mark

      where rdpri_table is the name of the primary table in the replication definition.

      If the table in the replicate database also has the same name as the primary table in the table replication definition, then you can use the with all tables named clause in the replication definition in the primary Replication Server. For example:
      create replication definition my_table_repdef 
      with primary at data_server.database 
      with all tables named rdpri_table
      If the table in the replicate database has a different name from the primary table in the table replication definition, then the table replication definition must map to the table in the replicate database. For example:
      create replication definition my_table_repdef 
      with primary at data_server.database
      with primary table named rdpri_table
      with replicate table name rep_table
Replicated Names and the owner Keyword
  • When pdb_setreptable is invoked with a primary table name and a replicated name, followed by the mark keyword, the primary table is marked for replication with the specified replicated name.

    By specifying a replicated name, transactions can be replicated to a table in the replicate database that has a different name from the primary table.

    Note: The replicated name you specify with the pdb_setreptable command must match a table name specified by a with all tables named clause in a Replication Server replication definition for the primary database connection. Replication Agent cannot validate the replication definition, but if it does not exist, or if the with all tables named clause does not match the replicated name specified with pdb_setreptable, replication from the primary table will fail.
  • You can also specify the owner keyword after the mark keyword so that when operations against the primary table are replicated, the primary table owner name will be attached to the replicate table name in the form owner.tablename.

    Note: If you want to use an owner-qualified replicate table name with the replicate owner’s name, use the owner keyword with the pdb_setreptable command. If you specify an unqualified replicate table name, the primary table owner name is sent with the replicate table name in the LTL.
Unsupported Datatypes
  • (UDB and Oracle) If a table contains a column with a datatype that is not supported for replication, the pdb_setreptable command using the mark keyword may fail with an error similar to:
    Command <pdb_setreptable> failed - Table <MYTABLE> could not be marked because:The table contains an 
    unsupported data type.
    To force the table to be marked, excluding the unsupported datatype columns from replication, add the force keyword to the pdb_setreptable command.
Errors
  • If the Replication Agent transaction log does not exist in the primary database (UDB) or the RASD is not initialized (Oracle and Microsoft SQL Server), the pdb_setreptable command returns an error.

  • If the table name you specify does not exist in the primary database, the pdb_setreptable command returns an error.

  • If the enable script execution encounters a fatal error on any database object, the pdb_setreptable command returns this message:
    Could not enable the following objects: ... 
    See error log for details.
Spaces in column names
  • To replicate a table that contains column names that have spaces, you must set structured_tokens to true.

Aliases
  • If you specify an alias or synonym as a primary table in the pdb_setreptable command, the actual table that the alias or synonym refers to is acted upon. The actual table name is the table name sent to the primary Replication Server.
Related reference
pdb_setrepcol
pdb_setrepproc
ra_config