CDC CONSISTENT
Olá, amigos,
It’s a post about one of the most questioned subjects that we receive.
I hope you all enjoy once it’s a very detailed one….
CDC consistent is a concept where Journalizing is carried at the Model level . As you all are aware of the point that in ODI CDC are of two types namely Simple and Consistent. We have already covered the Simple part early . You can visit this link for simple CDC steps. –http://odiexperts.com/changed-data-capture-cdc
O CDC Consistente é ótimo quando temos tabelas em um esquema relacionado entre si via relação PK – FK, já que o CDC Consistente são aplicados no Model ao invés do nível Data store como praticado em Simple.
Encontre a instrução passo a passo da configuração inicial do CDC Consistente
Passo 1. Edite o Model e selecione o modo compatível adequado Journalizing e selecione o KM consistente apropriado.
Passo 2. Adicione os datastores ao CDC.
Todos os datastores passam a exibir o ícone laranja em forma de relógio.
Passo 3. Adicionar o(s) assinante(s)
Passo 4– Start the Journal
Uma vez que o Journalizing é bem sucedido, o ícone do relógio laranja vai mudar para ícone verde.
Testando o CDC Consistente em vários scenarios.
A simples inserção está sendo transportada na Tabela de Código Fonte.
Dados mostrados na opção de dados Journalizing.
Vamos ver se os dados Jornalizados passam.
Os registros não parecem vir através. Vamos ver o problema ou a verdadeira razão por trás disso.
A tabela fonte do journalizing está lendo a partir da visão JV$, onde como os dados parecem estar lendo a partir da visualização JV$D.
A verdadeira razão por trás da leitura do ODI do JV$ em vez de JV$D é que o JV$ captura todos os registros do JV$D bloqueando o assinante.
Considere este exemplo dizer às 10 pm há 3 Inserts , 5 Updates e 1 deletes estão acontecendo no lado de origem e assim é capturado nas respectivas visualizações JV$D .
Aplicamos a tabela Extende windows e Lock Journalize e todos os registros no JV$D são capturados em JV$.Agora, nessa época, há novamente uma nova inserção 1 e assim é capturada nas visualizações JV$D. Como há bloqueio na tabela assinante . Novos dados não serão capturados em JV$ .
Let’s repeat the necessary steps and rerun the interface.
Passo 1. Extender a Janela
Passo 2. Assinante de bloqueio
Select the right subscriber
Passo 3– Run the interface
Passo 4 – Desbloquear o Assinante
Passo 5 – Purge Journal
Uma vez que os dados são capturados, o journal é purgado.
Vejamos como podemos processar as etapas acima via Package.
Passo 1 – OdiWaitforLogData
Além da configuração padrão fornecer o Logical Schema e fornecer o nome da tabela ou o CDC Set.
Passo 2 – Estender e bloquear assinantes do model
Arraste e solte o Model para o Package e no Tipo selecione Journalizing Model
e marque Extend windows and Lock Subscribers![]()
Passo 3– Interfaces
Agora chame as interfaces.
Passo 4 – Desbloquear assinantes e Purgar Journal.
Próximos passos após o arrastar e soltar a interface model e selecione Purgar Journal e Desbloquear Assinantes.
Vamos testar o package. Estou inserindo outro registro e vamos ver se os registros vêm através.
Os dados do Sim foram inseridos na tabela Target.
Tabela única por interface Limite.
Se houver n número de tabela Jornalizada em uma interface , apenas uma interface pode ser marcada como dados Jornalizados , mesmo que sejam consistentes com base .
Para evitar esse limite, revisei o código e reescrevi assim, para que possamos usar duas tabelas revistas sem precisar ler a tabela completa da outra fonte.
Note – There is a big assumption I am making that both the tables namely parent and child are dependent on each other via PK-FK and so if there is an insert in one the of the Parent table then there will be insert into the child table too
<% if (odiRef.getDataSet(i, "HAS_JRN").equals("1")) { %>
<%=odiRef.getJrnInfo("FULL_TABLE_NAME")%>.JRN_FLAG IND_UPDATE <%} else {%>'I' IND_UPDATE <%}%>
from
<%=odiRef.getSrcTablesList("", "[WORK_SCHEMA].<? if (u0022[IND_JRN]u0022.equals(u00221u0022)){?>JV$[TABLE_NAME] [TABLE_NAME] <?} else {?>[TABLE_NAME] [TABLE_NAME]<?}?> ", " , ", "")%>
where (1=1)
<%=odiRef.getJoin(i)%>
<%=odiRef.getFilter(i)%>
<%=odiRef.getSrcTablesList(" ", "AND [TABLE_NAME].<? if (u0022[IND_JRN]u0022.equals(u00221u0022)){?>JRN_SUBSCRIBER = 'SUNOPSIS' /* AND JRN_DATE < sysdate */ <?} else {?><?}?> ", " ", "")%>
<%=odiRef.getGrpBy(i)%>
<%=odiRef.getHaving(i)%>
<%}%>
Para usar o código acima em qualquer KM.
Marque o Datastore pai com a opção data store Jornalizado.
Substituir o código JRN_FLAG IND_UPDATE por <%=odiRef.getJrnInfo("FULL_TABLE_NAME")%>.JRN_FLAG IND_UPDATE
para que ele possa usar o pai JRN_FLAG para conduzir o alvo.
Replace the code <%=odiRef.getFrom(i)%> with <%=odiRef.getSrcTablesList("", "[WORK_SCHEMA].<? if (u0022[IND_JRN]u0022.equals(u00221u0022)){?>JV$[TABLE_NAME] [TABLE_NAME] <?} else {?>[TABLE_NAME] [TABLE_NAME]<?}?> ", " , ", "")%>
assim, se o datastore é publicado em seguida, a sua JV$ view associada é usado então o nome da tabela
Similarly replace <%=odiRef.getJrnFilter(i)%> with <%=odiRef.getSrcTablesList(" ", "AND [TABLE_NAME].<? if (u0022[IND_JRN]u0022.equals(u00221u0022)){?>JRN_SUBSCRIBER = 'SUNOPSIS' /* AND JRN_DATE < sysdate */ <?} else {?><?}?> ", " ", "")%>
Aqui para este exemplo eu usei o nome de assinante codificado rígido do SUNOPSIS, você pode usar a getoption e passar o nome de assinante na opção Interface.
A principal razão para reescrever desta forma é que, quando temos apenas uma tabela como revistaizada, ODI tem que ler através das outras tabelas infantis, mesmo que sejam Jornalizadas.
Vejamos um exemplo do código acima
SOURCE
Insira na tabela Regions duas regiões com os identificadores 7 e 8.
Registro é inserido com país _ID ID e região id 7
Olhando para a combinação eo Location pai dirigindo então ambos serão inseridos em JV$D visualizações para a respectiva tabela.
TARGET
Como você pode ver para o país id e região id 7 , a tabela alvo obteve corretamente o nome da Região associado.
Espero que este artigo lhe dê um melhor entendimento sobre o tipo consistente do CDC.
Obrigado e, por favor, continuem a visitar-nos.
abril 19, 2019 at 9:26 AM
Hi… I am using ODI 12c… I have implemented the CDC within Dev Environment..
I have to move the changes to another Environment (similary to prod) which has only Execution Repository..
Generally we deploy only Load Plans and all mapping scenarios..
In this case also we have done the same thing, but it is not working in the environment where i have moved..
Error Message –
java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
….
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: Error : 942, Position : 46, Sql = select count(FULL_DATA_VIEW) from ODI_WORKING.SNP_CDC_SET_TABLE where CDC_SET_NAME=:1 , OriginalSql = select count(FULL_DATA_VIEW) from ODI_WORKING.SNP_CDC_SET_TABLE where CDC_SET_NAME=?, Error Msg = ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:499)
… 43 more
Table listed in the error message – ODI_WORKING.SNP_CDC_SET_TABLE will get created while defining subscriber..
In addition tot he Mapping and Package Scenario, do i need to move anything specific to Execution Repository.
Please help with this query…
abril 19, 2019 at 3:44 PM
Hi… Did you already check about the users grants? The most common problem when this error is raised is about the user being used in the connection has no grant on the table in the query…
novembro 27, 2017 at 8:49 PM
Hi,
When was update this page? when I review this page I didn´t remember the component OdiWaitforLogData
novembro 27, 2017 at 9:50 PM
Hi Alex,
there is no update for years…
agosto 7, 2017 at 11:46 AM
Hi Cezar,
I am using odi 11g. I have a model with 4 datastores and these datastores have been used by different subscribers. Like
Datastore 1 and 2 are used by subscriber1 and datastore 1, 2 and 3 are used by subscriber2. This is resulting in lots of junk data in JV$D table which will never be used by any process.
Creating a separate model per subscriber is not the option.
Could you please suggest something to handle this situation.
agosto 7, 2017 at 6:25 PM
Hi,
If I understood right, you should create the subscribers per tables, not per model and so, the problem should be solved.
But if not, just create a ODI procedure that that delete any unnecessary data from J$… that executes at end of consumption. Make sense?
agosto 21, 2017 at 9:14 AM
Hi Cezar,
We cannot create subscriber on a table. It is only model based.
Yes I have created a procedure for deleting the records from J$ but I want to know if there is any other process?
maio 15, 2017 at 8:37 AM
Hi,
What could be the best way to migrate aggregated data from one instance to another instance:
1. Every time purge all the data from the target instance and reload all again.
This is not possible at all. Because millions of row can not be migrate (purge and reload all) after every hour.
2. Load all at first time and then Move only changed data to the target instance
Question 1: How do we migrate aggregated data from source DB to the target DB?
This step is done.
Question 2: And How do we move changed aggregated data after first load?
I am assuming the aggregated term for Sales or Collections Transactions not the Master Data.
Regards,
Waqas
agosto 13, 2014 at 8:52 AM
Can I create index on J$ tables?
agosto 14, 2014 at 6:14 PM
Yes, and I suggest you to add the create step at JKM…
maio 29, 2014 at 4:01 AM
Hi, this is an old post, but hopefully, someone can still answer my question.
I’ve tried following the instructions to modify the knowledge module to overcome the “Single Journalized table per interface Limit”.
However, I get the following errors because of this line:
<%=odiRef.getSrcTablesList("", "[WORK_SCHEMA].JV$[TABLE_NAME] [TABLE_NAME] [TABLE_NAME] [TABLE_NAME] “, ” , “, “”)%>
The error I am getting is:
com.sunopsis.tools.core.exception.SnpsSimpleMessageException: ODI-17517: Error during task interpretation.
Task: 17
java.lang.Exception: BeanShell script error: Sourced file: inline evaluation of: “out.print(“insert /*+ APPEND */ into “) ; out.print(snpRef.getObjectName(“L”, ” . . . ” : Undefined argument: u00221u0022 : at Line: 8 : in file: inline evaluation of: “out.print(“insert /*+ APPEND */ into “) ; out.print(snpRef.getObjectName(“L”, ” . . . ” : ( u00221u0022 )
It is complaining about the argument “u00221u0022”. Could someone show some light as to what this argument is and if this is the correct value or a typo on the example show?
Much appreciated 🙂
maio 29, 2014 at 4:04 AM
Sorry, the code that I am getting problem with is:
<%=odiRef.getSrcTablesList(" ", "AND [TABLE_NAME].JRN_SUBSCRIBER = ‘SUNOPSIS’ /* AND JRN_DATE < sysdate */ “, ” “, “”)%>
Also, we are using ODI 11g.
maio 29, 2014 at 4:06 AM
<%=odiRef.getSrcTablesList("", "[WORK_SCHEMA].JV$[TABLE_NAME] [TABLE_NAME] [TABLE_NAME] [TABLE_NAME] “, ” , “, “”)%>
janeiro 30, 2014 at 8:48 AM
I have followed the above post to implement Consistent CDC using the latest ODI 12c and JKM Oracle 11g Consistent (Streams) KM. I would like to draw the attention to those users trying to implement the same kind of CDC, that when one chooses the KM in question for a Data Model, one needs to change the ‘Validate’ Option from ‘default: true’ to false.
The reason behind this change is to ignore validation errors coming from the KMs code when trying to re-created the tables, PKs etc. during a subsequent ‘Start Journal’ task. The first ‘Start Journal’ task on any datastore within the data model creates the necessary tables with the STREAMS_OBJECT_GROUP prefix. Subsequent ‘Start Journal’ tasks on other datastores will try to re-create the same tables and if the ‘Validate’ option is set to true it will raise errors causing the ‘start Journal’ task to fail.
janeiro 31, 2014 at 11:56 AM
Thank you Mario!!!!
novembro 22, 2013 at 4:50 AM
Hi,
Please reply on the above request if anyone have an idea.
Thanks in advance.
Regards,
Archana
novembro 20, 2013 at 11:51 AM
Hi,
There is one table which having foreign key constraints on another schema table.Then can i use jk,m consistent.if yes,how?
Please advice on priority.
Thanks,
Rao
agosto 5, 2013 at 5:04 AM
can u please tell me where to replace above code in KM?
cheers,
Hari….
agosto 5, 2013 at 1:25 PM
you will need to use this code to load into i$ table.
setembro 26, 2011 at 12:37 AM
I have got this situation, whereby I need to have consistent CDC. The form of consistent required is that for 2 tables of PK-FK relationship, either both will be journalized or non.
For example, if there’s changes to a set of parent-child records, it will be journalized. If there changes to the child record, but no changes to the respective parent record, it will not be journalized.
I’ve tried your steps on this webpage multiple times but it doesn’t seems to work the way I want. Is there any details which I need to specifically watch out for?
Thank you
julho 6, 2011 at 2:02 PM
Cezar, devendra,
can we use ODI for loading the data from oracle databse to coherence cache.
If yes, then details pls.
junho 8, 2011 at 2:22 AM
Hi Cezar,
in your post (SINGLE Journalized table per interface at ODI 11) you said( ”
Replace the code JRN_FLAG IND_UPDATE with .JRN_FLAG IND_UPDATE”
Replace the code with <%=odiRef.getSrcTablesList("", "[WORK_SCHEMA].JV$[TABLE_NAME] [TABLE_NAME] [TABLE_NAME] [TABLE_NAME] “, ” , “, “”)%>”)
I searched in all kms that in ODI 10.1.3… I didn’t see (odiref.getFrom(i))&(odiRef.getJrnfilter(i))
where can I find (odiref.getFrom(i))&(odiRef.getJrnfilter(i)) in odi10.1.3 KM ?
شكرا جزيلا THANK YOU
junho 7, 2011 at 5:14 AM
Hi cezar
I think odi 11g use (odiref.getFrom(i))&(odiRef.getJrnfilter(i))in it’s km’s
but I want this issue in ODI10.1.3…. which use (snpRef.) in it’s km’s
please I want it in detail
it’s very important for my project
THANK YOU VERY MUCH
abril 15, 2011 at 7:52 AM
Is this for 10g or 11g? I’m trying to programmaticly drop journal(remove J$ and jv$). Any idea? Thanks
abril 15, 2011 at 9:28 AM
This post was build on 11g but I don’t see problems in apply to 10g. Maybe some smalls details…
To drop the J$ and JV$ use the “stop journal” option from model or table.
Make sense?