How to use Change Data Capture in Oracle (Step 3/4) Implement a Change Data Capture (CDC) under Oracle

In this tutorial, you will modify the data in the Customers table, and observe how CDC manages these changes.

This tutorial is part of a serie of four tutorials:
- [How to use Change Data Capture in Oracle (Step 1/4)]
- [How to use Change Data Capture in Oracle (Step 2/4)]
- [How to use Change Data Capture in Oracle (Step 3/4)]
- [How to use Change Data Capture in Oracle (Step 4/4)]

Download it!

Do you want to practice?

Download tutorialProject.zip includes all the jobs needed to carry out this tutorial. Please, download it!

You can also:
Send it!

Share it!
Next Step: [How to use Change Data Capture in Oracle (Step 4/4)]

 


Step 1: Modify the Customers table


In your web browser, connect to Oracle using the DATA user.

Click HOME > Object Browser > the CUSTOMERS table.

Click the Data tab to preview the data of the table.

Change the data so that there is at least one modification of each type.

Click Insert Row to insert a new row.

Click the EDIT icon corresponding to the row you want to update or delete.

Next

In the Insert Row form:

Fill in the data in each field of the form to create a new row.

Click Create to validate and insert it.

Next

In the Edit Row form:

Modify the data in each field.

Click Apply Changes to validate and update the data.

Next

In the Edit Row:

Check the data correspond to the data you want to delete.

Click Delete.

Next

On your Oracle connection page, get back to the Data tab and you will see the changes applied to the data.

Next

Step 2: Preview the data from the Studio


In the Studio, click  Metadata > Db Connections > CDC_Oracle > DATAOracle > Table schemas. Cliquez-droit sur CUSTOMERS, and select View All Changes.

Next

In the Studio, click Metadata > Db Connections > CDC_Oracle > CDCOracle > Table schemas. Right-click TCDC_CUSTOMERS and select Data Viewer.

In the TCDC_CUSTOMERS table you will see all the changes that you have made.

You can also access these changes by creating a job to read the TCDC_CUSTOMERS table in the CDC database.


Next

In the Studio, click Metadata > Db Connections > CDC_Oracle > DATAOracle > Table schemas. Right-click on CUSTOMERS and select Data Viewer.

Next

Step 3: Modify the data from the Studio


On the Repository, right-click on Job Designs and select Create job. Name it ModifyTablesOracle.

Next
Drag and drop DATAOracle metadata to the Job Designer from the node Metadata > Db Connections and, in the [Components] dialog box, select tOracleInput.
Next
Check that the fields are filled as in the screenshot.

Fill the query: select customers.id, customers.name, customers.firstname, customers.age from customers where id ='1' in order to delete the first row.
Next

Drag and drop DATAOracle metadata to the Job Designer from the node Metadata > Db Connections > DATAOracle and select tOracleOutput in the [Components] dialog box.


Check that the fields are filled as in the screenshot.

Do not forget to select Delete in the Action on data list.

Next

Connect the two components with a Row Main link. To do so, right-click on the input component, drag to the output component, and click it. Rename the link delete by clicking the name.

Next

Drag and drop two DATAOracle metadata in the Job Designer from the node Metadata > Db Connections > CDC_Oracle > DATAOracle.
For the first one, select tOracleInput in the [Components] dialog box. For the second one, select tOracleOutput.

Next
Double-click the tOracleInput to display its Component view. Do not forget to fill the query as follows: SELECT customers.id, customers.name, customers.firstname, customers.age FROM customers WHERE id ="2" in order to update the second row.
Next

Double-click the tOracleOutput to display its Component view.

In the field Action on data, select Update.

Next

In the Palette, click the Processing folder.

Drag and drop a tMap component in the Job Designer.

Next
Link the input DATAOracle to the tMap. To do so, right-click on the tOracleInput, drag to the tMap, and click it.

Then, link the tMap to the output component. Right-click on the tMap, drag to the tOracleOutput, and click it. A dialog box asks you to name your link. Name it Updating and click OK. A new dialog box asks you of you want to propagate the changes. Click Yes. Click on your link name, et rename it Update.
Next

Double-click the tMap component in order to open its editor.


Configure it as shown in the screenshot, and click OK to validate and close the editor.

Next
In the Palette, click the Misc folder, drag and drop a tRowGenerator component into the Job Designer.
Next
In the Repository, click Metadata > Db Connections > CDC_Oracle > DATAOracle. Drag it to the Job Designer. In the [Components] dialog box, select tOracleOutput.
Next
Link the tRowGenerator to the second output DATAOracle. To do so, right-click the tRowGenerator, drag to the tOracleOutput and click it. A dialog box asks you if you want to get the schema of the target component. Click Yes. Then, click the name of the link, and rename it Insert.
Link the input DATAOracle to the tRowGenerator. To do so, right-click the input, select Trigger > OnSubjobOk, and click the tRowGenerator.
Next
Double-click the tRowGenerator to open its editor, and configure it as shown in the screenshot.
Next

Press F6 to execute the Job.

Next

Click Metadata > DB Connections > CDC_Oracle > DATAOracle > Table schemas. Right-click CUSTOMERS and select View All Changes in the menu.

In the TCDC_CUSTOMERS table you can see all the changes you have made.


 

    Download it!     Send it!     Share it!

Do you want to practice?

Download tutorialProject.zip includes all the jobs needed to carry out this tutorial. Please, download it!

Friends / colleagues may be interested in this tutorial? Send it to them!

You liked this tutorial ? Support it!

[ top ]