Product: | Syniti Replicate (a.k.a Syniti Data Replication, DBMoto) |
Version: | All |
ID: | 1529 |
Summary: | Requirements for Oracle source tables in transactional replications |
Q.
I want to perform an incremental (mirroring) replication using Oracle as a source database. Are there any specific settings in Oracle or in Syniti Replicate that I need to consider?
A.
Yes. There are different conditions for incremental replication depending on the Oracle version that you are using.
Oracle 9 and above
There are no specific settings you need to make for Oracle versions 9 and higher. However, if you have not defined a primary key in your Oracle table, you will need to map the Oracle ROWID column to a target table column so that records can be uniquely identified. You then need to set the target table column as the primary key. See below for instructions on mapping the Oracle ROWID column.
Mapping the Oracle ROWID column (all target databases except Microsoft SQL Server)
To use the Oracle ROWID column to identify each record:
- In the target table, create an additional column of type String.
- If you have not yet created the replication, when you get to the Set Mapping Info screen of the Replication wizard or Multiple Replications wizard, choose to map the newly created column to an expression.
If you have created the replication, in the Replication Properties dialog, open the Fields Mapping dialog and choose to map the newly created column to an expression. - In the Expression Generator, expand the tree to display the Values node. (If replicating to SQL Server, skip to the specific instructions for SQL Server below.)
- Expand the Values node to display Log Field values.
- Select the !RecordID value.
The !RecordID value represents the Oracle Row ID. - Click OK in the Expression Generator.
You have now set the value of the column that you created above to the Oracle Row ID.
To set the new column as a primary key: - In the Metadata Explorer, select the target table.
- From the right mouse button menu, choose Set Primary Key to open the Define Primary Key dialog.
- Select the column name in the Fields column, then click the right-facing arrow to move the column name into the Keys column of the dialog.
- Click OK in the Define Primary Key dialog to complete the operation.
Any time you reorganize a source table (to compress deleted rows, etc.), Syniti Replicate needs to perform a full refresh of all the target tables mapped using the Row ID.
Mapping the Oracle ROWID column with a Microsoft SQL Server Target Database
To use the Oracle ROWID column to identify each record:
- In the target table, create an additional column of type Binary with length 30.
- If you have not yet created the replication, when you get to the Set Mapping Info screen of the Replication wizard or Multiple Replications wizard, choose to map the newly created column to an expression.
If you have created the replication, in the Replication Properties dialog, open the Fields Mapping dialog and choose to map the newly created column to an expression. - In the Expression Generator, expand the tree to display the Values node.
- Expand the Values node to display Log Field values.
- Select the !RecordID value.
The !RecordID value represents the Oracle Row ID. - Create the following expression with the !RecordID value:
System.Text.Encoding.ASCII.GetBytes([!RecordID])
- Click OK in the Expression Generator.
You have now set the value of the column that you created above to the Oracle Row ID.
To set the new column as a primary key: - In the Metadata Explorer, select the target table.
- From the right mouse button menu, choose Set Primary Key to open the Define Primary Key dialog.
- Select the column name in the Fields column, then click the right-facing arrow to move the column name into the Keys column of the dialog.
- Click OK in the Define Primary Key dialog to complete the operation.
Any time you reorganize a source table (to compress deleted rows, etc.), Syniti Replicate needs to perform a full refresh of all the target tables mapped using the Row ID.