Changed Data Capture (CDC)
Simple is used
for CDC implementation on a single table and Consistent on Multiple tables or
Model.
Simple
CDC – Oracle Table
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU5X2XC3f22j1inb3Gy8zTsPsxKiZmCt399tu1Trk4gzY0g3FQV5pxWfaUDU12GTa2ihF1VxoiTaFO6aiQ-a703caLZD0H559qjJsJdCca7y9f56jJ_tRytIcscsKgx7tzAZzl16DoBrg/s1600/1.png)
I am going to
implement the Simple CDC concept on this particular table – SRC_AGE_GROUP.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaRdZgH1haXNTA4uDEOspZMSFOPf82VIpBsUTkUXBaQeTLJqJleoTDy7K-IL9Gkbsw0wuqMBFUhW_LryVrTP6MODIf4P9vS7tGeTyf6r9bCHmJHFhfhPjj5H78P1Ogx4pREzkB6ne2NwQ/s1600/2.png)
Step 1 – Adding
the Table to CDC
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd1Sw9Z7s1jnff5mLifIYHUqf3Yd3ej4FmhBXax5SZsnIBS00md0QZiIg9Jhm_o_R2zPYRCBw3fsdDty5BcFTjEiyUJ5fxBVAZsZshJ_2dx-gQXV3nhiq7Z0beg1ttGqLA3xYizStSIQ4/s1600/3.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ_KU48QMPhSKTaqhQYioZHTreEKUx8S8vTcWwdTsbJl076uA00Vi3yErzLFlh-rxHzh986n54Lm9HZyelmQ5KX9ex-fpG0SAg3GfZZqPXY2iQfy1Oy_brsmxZ4HdHl88b0hX-7nen_cY/s1600/4.png)
Step 2 – Starting
the journalizing
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj90wkGPXaoiqDzy5feYS8cX0JfmqV-yIN2Je8PRTvCTJBONfJxBRYeymk3ZouYCXfNuiIIETJHwcNZp7u1-16gUoohWnMmKThviktTFbADOKYz8GYmgDaFPeD5PmfKDg0e22n8-gb7hkM/s1600/5.png)
Select the user
as Subscriber
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF_C2IWq0njxihLrg_I_teDKccI0HCKmLp6ZRoC7Ue6M0pE0448nzyJD0YwsrFjLGhIRCnV5OXynCk0PFDoYLaHhjHEgTmNMTaJvr1Au7fO-WgggWk-_l4EsXLiGPlwKs0eP7sOXJ5810/s1600/6.png)
Execute it
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Hp6qXubKlWZCOSJiHWtRiucG0BKJbWO-loZNquhQFNd30XbSQdI53ZgyK6R5U3lLZKp5Im6J94x6uuvG3wKDKQhkG2kcuB-MWx8Gh8ypQ7AwYYCd7IoD13Oq7S-_7aG2wL4vE2IZIaY/s320/7.png)
The journalizing
process is established.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_T65SXhAreD9i50vXQ0wOItNa3KPZZDMlY60KyWRo8sLVJ3z_9zX1YrhqZUvnMZY-wXmNgarQqUDj6rUaWI5aeAzX3qZff1WR91ukTfVB9NUhQ5xWLzMZC2COrsl4rJ4lOD5M3bBtp6c/s1600/8.png)
In the above
execution ODI creates a Subscriber table in the work schema, J$ table, view and
a trigger to capture any data changes when any Insert, Update and Deletion
takes places.
After successful
execution you will be able to see a small green clock icon.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeGYSKUOuBVTbC8A-xDtgmkQ-Hkbj7d2UFPpxx_nLnZVn3kPnfxb1I7oi3IkY8Q_QhjjdiCBAEObVF-2iDWeTPJ8NnpI971FH0em5LG-7YrfjncyLXf5yLVsHfbIRVBEnePTCPYXfom2g/s1600/9.png)
Let’s do a simple
mapping and test for CDC.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcE5sSD6TKcs8xigWjaUgYPmxc2jPo7uxep_SyJRkt-xoBJPE1KlqUAk6O1p3D7KAeLE9VBZ3bCXtvI2Qx4jR5YFtq6HII0OKIQxztPki7SkWhIfijAK0iKby5S23tkRf1Tm_YdDina-g/s1600/A1.jpg)
Drag the
Journalized Table as source and the required target. On the Source Data store,
check mark the option “ JOURNALIZED DATA ONLY “ and ODI will
automatically add a filter with a required date condition and subscriber
information, use the proper LKM and IKM as per your technology. For this
Example I have used IKM Oracle Incremental Update.
I have run it
once to check whether its working fine or not. Now let me show you an example.
Original Source
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOhGtMB8Dxxqkt_iQ99F9X83dlrZQSigI31JTPIEiu1zbS5ZMX218GZY_WJKovCoFR4-5lnPC4mq2TRbX_7iS5sxNZ1G8yKiTy8OPTW6qOjImcgCsELlws4lP-5OyPLV51K5lqxU-pcQE/s1600/A2.jpg)
Modified source
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm7CCPHb9_vgpo0qjGPID6pSSkJ7roUixspqJ4YMIMgUHZYqyVdiSdbT_v7KMX65jXLigiiWYhuBbIUjnVFnSLEP8UTq_hBQfj9a2PCOjJ7zZxAokYpc7sZHGRbGvmXvqK5Ds686twGkw/s1600/A3.jpg)
I have removed
the last column and change the third row age_max 39 to 35.
There are two
ways of seeing Journalized Data.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb7FHCU7Xc8NvirgvpKIHll0ViL3gzL13jKo6K5NOPZw86H59VAgwz_uOMWTzn-XkS94wOzqTI9PBbvaBCOPFErzMKa1Mz3jODKckl71iawK2D331Kcd1CCBfp6TukApw3KxWMumD3jco/s1600/A4.png)
On the
Journalized Interface source and Right click on filter and click on data.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEies9OyBsEZ5rO8r5vU5BhStC9mqExi3BQ3CKecyG0_P3nFIokCbKjMwmD4tg7Y-OSRWkFC_cVfIsUqobiyFtg_9x7xONVOazMt18ahmA8m5jBBW8l4NcYpXyPYI6-VzAz2uwHRDNZryJ4/s1600/A5.png)
Here is the sql
from where the journalized data is being retrived
select
* from ODI_TEMP.JV$DSRC_AGE_GROUP SRC_AGE_GROUP where (JRN_SUBSCRIBER =
‘SUNOPSIS’ /* AND JRN_DATE < sysdate */)
The Other way is
to right click on Journalized data store in Model and Changed Data capture –
> Journal Data and you will see the above data again too.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyqM2x9ABk9T8Jx6T_QaGT088Ye5or8TFkPSKOBm7U8tagyys-CM5phQ0C3gsrhqLhvIAcLyzlnp1g2SK6ilBUcMQsvYqM3yl4L_3R19gRN3gqzsEw-vAJJ90fuFClANhsEfle11_0HiQ/s1600/A6.png)
Let’s capture the
Journalized data to my Target table.
Target Table
Before running the Interface
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSr7fVcr1bMLpOCwh2QgPYUrVZBuwB2SV0ON7uUTso97AqHpN8cTWmDtefuF-J2HOdjsZ3AyLcdJTWVOJuUKp23VmMFglJasofnlo0T66JFNTKEgi0i22CnF51dSuJjEl9EoEtgwDjfR4/s1600/A7.png)
As you can see,
one Update and one Deletes.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGwxhMRsE4ifrxhyphenhyphentsoG_LuUd2EYzjZj4wkDDHteswFIfePqMeaIsEOfvZlcvNtgZ3raE2nUQuhSZS1e2hqwuH52hs31-0CTw-yexZJShI-emTJkslZYZAUDpsxHfn4beVuPNpy2krT-E/s1600/A1.jpg)
Target Table
after running the Interface
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJTPVaVNx0Z29LdvzqykuMxdH7os94Y_DadHpk92Zh1hZhLP04Y11t9PQbRveFWfa7_bAD5aEy_B6nuYUAGdXNNzVYFB0wNiHB6wGYl67IIC3zv1iRdhiDhyXBTeemb4B-eIU4tNoOW2Q/s1600/b1.png)
Repeat the above
steps for Journalizing SQL Server table as we did for Oracle namely
Add to CDC
Start Journal
And if everything
is start the journalizing will start.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhL1O_PeCydGhgoXiiZoN6tGQEvmGDmf0D2EBYao4WpsWEh0BQGy18z5KZI1JswGTnBO2xvz3QYr4uyELaK8AWfC2hFElcwdfb1xBAzAM1rbqsy8t2OBElT_M1E2YASyvQF1wHkFijgo/s1600/b2.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWcRrmuTM9bbrri49s9YwOnL2BIIl1MJaUU9X66w6ISSk4hiurQFw8d6nquVgQarpAb-bQBVc7rB15XgZH4023CYXywpY_9L76U5YYEpdTFSeQDF1ICWO3RDksEjNipHJpeZ-RbDzV-jM/s1600/b3.jpg)
Source Data before
Running the Journalized Interface
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy8_ftnhUSqgk7sowylcrfp1fDbrV5AqaniQIJaSqi5VdaQrkvXa2TorZa-RWOtomjIsrcf1anE4EVfF7mJNFPEw8AZPCd4yphRW3KdndvKfuUWumyfLHslVVCSFAUdXSX0_dISvoQybk/s1600/b4.jpg)
delete from
dimtime_backup where TimeKey=6;
update dimtime_backup set DayNumberOfWeek=4 where TimeKey=4;
update dimtime_backup set DayNumberOfWeek=4 where TimeKey=4;
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvK8HrfkrSSnA_hFDoLyRRtz4Yebb-JYtJd03dd8eFfp9fdiuqFB6hsO7MnYoq_AC56-U6lSmyXXgRZpLP5ypT3fnDhctgMJRU7OsurQa10UEVAoZOdz1toyR3sF-f7OEIpZDTLkIAWQo/s1600/b5.jpg)
Journalized Data
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN2roNjs7n_8SSWWoDUeKUzn8piCmVEtm8xzb-XIdVIpCpsM2mrS_0vfkCY8KoBkOMVpUysdydyoJj3Teop8J-ErZXCMgN8h7iG7TA5MGb7sOBYq2ivzg7xexO9i1J67UOx4zXzIRwrvw/s1600/b6.jpg)
Although there is
update and Delete on the source but there is just delete in the ODI reason
being I have update the same value DayNumberOfWeek=4 again for update so ODI
have correctly did only the Delete as the target already had the same value
which is DayNumberOfWeek=4
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Qcz__kma_FMqnr_vThYiD7SViP3rlwpW8sj4X4TXwloi28dK9ZYxxkJkTUjlJwaiEz51w_hsBD6aNlrNFm85Glin7DvvH5izye2XNxQmAr5Ip5SLICZ1OYnGFHG_1l6fqsgoNTxq-pk/s1600/c1.jpg)
How to say
whether you have which JKM you have , right click on your model ,
Edit –
>Journalizing Tab and you see what JKM is being used and whether Simple or
Consistent
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtu0adX-JyfSnqRrDoQDDi2Z9J8YNa2ji4jpdnGaeRxh-DOwj7ZMB7qKIdLi9hjPMwQlorS6AH5m-4xtowH0Y93n4g20uI_AqueLPFd4n9n-hzlun7cfWe8lYiY6w5tM-Zq08mlZEheVs/s1600/c2.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigos2rdH5TrE4jsXwjbN_PyVwDJ0ThnexMTTiDd6ra5hApSNlimMa-JSJTi1JDvoc6k061_DUJL-C9nbRy9q_k8X2HjpR1YiMgyjCDFjACSURyryIPIE0Ll5wmb0IVNCZ1usKcOg05QL0/s1600/c3.png)
No comments:
Post a Comment