Vous êtes sur la page 1sur 4

19th November 2015

ODI CDC BACKEND PROCESS

ODI CDC BACKEND PROCESS

In my previous post have described how to implement CDC in ODI 11g. Now am going to explain how it will work backend process.

Once CDC enabled you can see below table and views and trigger will be created in database.

J$ and JV$ and JV$D

Trigger Name : T$SATYA_W_PARTY_DS

In my case tables was created below names.

1. J$SATYA_W_PARTY_DS -- Table

2. JV$SATYA_W_PARTY_DS -- View

3. JV$DSATYA_W_PARTY_DS -- view

What does the table in backend(J$ ):-

J$ tables contains the PK of the changed records in the table that is monitored for changes, along with the name of the
subscriber for whom that change is recorded.
For ex:- See my below screen for your reference.

[http://3.bp.blogspot.com/-ZwMUyc7Q4CI/Vk1t3hZIH0I/AAAAAAAAAJw/y30wgKprm34/s1600/Screenshot_17.jpg]

Now we will discuss in detail for all the columns (J$)

JRN_SUBSRIBER :- Subscriber details will be store in this column.

JRN_CONSUMED:The JRN_CONSUMED is used to logically lock the records: when the records are inserted in the J$ table, the value is set to 0.
Note :- Simple CDC the lock/unlock opera ons are performed by the IKMs. When the IKMs lock the records, the value is changed to
1. The unlock process only purges records with a value equal to 1.

JRN_FLAG:- The JRN_FLAG column indicates the type of change detected in the source system. Deleted records are
JRN_DATE:- Date and me of the change.
PK Column : Column x of the primary key (each column of the primary key of the source table is represented as a separate
column in the J$ table)
What does the view in backend(JV$ view ):-

The JV$ view is the view that is used in the mappings where you select the op on Journalized data only. Records from the J$ tables are ltered
so that only the following records are returned:

Only Locked records : JRN_CONSUMED=1

If the same PK appears mul ple mes, only the last entry for that PK (based on the JRN_DATE) is taken into account. Again the logic here is
that we want to replicate values as they are currently in the source database. We are not interested in the history of intermediate values
that could have existed.

What does the view in backend(JV$D view ):-

Similarly to the JV$ view, the JV$D view joins the J$ table with the source table on the primary key. This view shows all
changed records, locked or not, but applies the same lter on the JRN_DATE column so that only the last entry is taken into
account when the same record has been modied mul ple mes since the last consump on cycle. It lists the changes for all
subscribers.

[http://3.bp.blogspot.com/-V2_d3CUNm8Y/Vk12iZt6xAI/AAAAAAAAAJ8/-ZRmFMxVHfc/s1600/Screenshot_18.jpg]

Finally we will talk about trigger. What does trigger will do in backend?

Trigger will check what type of changes happen in source table . Insert or update or delete . Based on type it will dene JRN_FLAG in
J$ table.
For Ex:- For your be er understand have provided my trigger script.

CREATE OR REPLACE TRIGGER XXXX.T$SATYA_W_PARTY_DS AFTER


INSERT OR
UPDATE OR
DELETE ON XXXX.SATYA_W_PARTY_DS FOR EACH row DECLARE V_FLAG VARCHAR(1);
V_DATASOURCE_NUM_ID NUMBER(10);
V_INTEGRATION_ID VARCHAR2(80);
BEGIN
IF inser ng THEN
V_DATASOURCE_NUM_ID := :new.DATASOURCE_NUM_ID;
V_INTEGRATION_ID := :new.INTEGRATION_ID;
V_FLAG
:= 'I';
END IF;
IF upda ng THEN
V_DATASOURCE_NUM_ID := :new.DATASOURCE_NUM_ID;
V_INTEGRATION_ID := :new.INTEGRATION_ID;
V_FLAG
:= 'I';
END IF;
IF dele ng THEN
V_DATASOURCE_NUM_ID := :old.DATASOURCE_NUM_ID;
V_INTEGRATION_ID := :old.INTEGRATION_ID;
V_FLAG
:= 'D';
END IF;
INSERT
INTO XXXX.J$SATYA_W_PARTY_DS
(
JRN_SUBSCRIBER,
JRN_CONSUMED,
JRN_FLAG,
JRN_DATE,
DATASOURCE_NUM_ID,
INTEGRATION_ID
)
SELECT JRN_SUBSCRIBER,
'0',
V_FLAG,
sysdate,
V_DATASOURCE_NUM_ID,
V_INTEGRATION_ID
FROM XXXX.SNP_SUBSCRIBERS
WHERE JRN_TNAME = 'XXXX.SATYA_W_PARTY_DS'
/* The following line can be uncommented for symetric replica on */
/* and upper(USER) <> upper('XXXX') */
;
END;

Hope this help's


Thanks,

Satya Ranki Reddy

Posted 19th November 2015 by satya R


Labels: ODI
0

Add a comment

Comment as:

Publish

Notify me

Vous aimerez peut-être aussi