Marking and unmarking tables

To replicate transactions that affect the data in a table in the primary database, that table must be marked for replication, and replication must be enabled for the marked table.

Marking a table can be separate from enabling replication for that table. If the value of the pdb_dflt_object_repl parameter is true, replication is enabled automatically at the time a table is marked. For more information, see “Enabling and disabling replication for marked tables”.

The table-marking process of trigger-based Replication Agents for Microsoft SQL Server is different from the table-marking processes of the Replication Agent for UDB and the Replication Agent for Oracle.

Table marking with trigger-based Replication Agents

When a table is marked for replication, a trigger-based Replication Agent creates several transaction log objects in the primary database to support replication for that table:

where:

NoteThe prefix string recorded in the pdb_xlog_prefix parameter is used for naming all Replication Agent transaction log database objects.

For example, if the value of the pdb_xlog_prefix parameter is ra_ (the default), and two tables have already been marked, the Replication Agent generates the following transaction log object names for the third marked table:

NoteIf triggers exist on the table, the Replication Agent attempts to insert its trigger code, leaving the existing trigger code intact. You can configure the Replication Agent instance to simply build a script to mark the table—but not execute it—by setting the value of the pdb_auto_run_scripts parameter to false. To complete the table marking, you must manually execute the script.

If you need to change the schema of a marked table in the primary database, you must unmark the table to remove the shadow table, stored procedure, and triggers that Replication Agent creates for the primary table, and then change the primary table’s schema and re-mark the table.

NoteIf you change the schema of a primary table, you may need to rematerialize the replicate table.

Table unmarking with trigger-based Replication Agents

When you unmark a table marked for replication, a trigger-based Replication Agent removes the transaction log objects for that table from the primary database.

Sybase Replication Agent provides two ways to unmark an object:

NoteForced unmarking can cause transactional inconsistency between the primary database and replicate database. In general, use it only when you are removing the entire transaction log and discontinuing replication from the primary database, or in troubleshooting procedures.

Table marking with the Replication Agent for UDB

When a table is marked for replication with the log-based Replication Agent for UDB (DB2), the Replication Agent does the following:

If you need to change the schema of a marked table, you must:

  1. Lock the table so that new operations cannot change any data in the table.

  2. Wait for the Replication Agent to complete its processing of any logged transactions in the table.

  3. Quiesce the Replication Agent instance.

  4. Change the table’s schema, without changing the DATA CAPTURE option.

  5. Unlock the table to allow normal user or client access.

  6. Use the Replication Agent resume command to restart replication.

NoteIf you change the schema of a primary table, you may need to rematerialize the replicate table.

Table unmarking with the Replication Agent for UDB

When you unmark a table marked for replication with the log-based Replication Agent for UDB, the Replication Agent does the following:

When a table is unmarked, any subsequent operations that affect the data in that table are ignored (not replicated).

NoteIn the event that the Replication Agent for UDB must re-scan the transaction log (such as when recovering from a replication error), transactions recorded prior to unmarking a table will not be replicated.

Table marking with the Replication Agent for Oracle

When a table is marked for replication with the log-based Replication Agent for Oracle, the Replication Agent does the following:

When a table is marked, any subsequent operations that affect the data in that table are replicated.

Table unmarking with the Replication Agent for Oracle

When you unmark a table marked for replication with the log-based Replication Agent for Oracle, the Replication Agent does the following:

When a table is unmarked, any subsequent operations that affect the data in that table are ignored (not replicated).