Replicating Tables With Foreign Key Relationships in an Active Standby Pair

With the active standby pair replication scheme, you may choose to replicate all or a subset of tables that have foreign key relationships with one another.

You can create the tables and the foreign key relationship on the active master either before or after the active standby pair replication scheme is created.

  • Before creation of active standby pair: You can create the tables and the foreign key relationship on the active master before the active standby pair replication scheme is created. Then, create the active standby pair replication scheme.

  • After creation of active standby pair: You can create the tables and the foreign key relationship on the active master after the active standby pair replication scheme is created. In order for the tables to be automatically replicated to the standby master and added to the replication scheme, you must be using the default mode where DDLReplicationLevel is set to 2 or larger and DDLReplicationAction='INCLUDE'. See Controlling Replication of Objects to All Databases in an Active Standby Pair.

If a child table with a foreign key defines ON DELETE CASCADE, then you must replicate any other table with a foreign key relationship to the child table. This requirement prevents foreign key conflicts from occurring on the standby master tables when a cascade deletion occurs on the active master database.

TimesTen Classic replicates a cascade deletion as a single operation, rather than replicating to the subscriber each individual row deletion which occurs on the child table when a row is deleted on the parent. As a result, any row on the child table on the subscriber database, which contains the foreign key value that was deleted on the parent table, is also deleted, even if that row did not exist on the child table on the master database.