Skip to content

August 18, 2011
by kdevendr
17 Comments

Categories: How to , Logic , ODI , Others

Tags: , ,

Single Post View


ODI SDK Setup and Config in Eclipse

ODI SDK gives ODI 11g a big edge and a large possibility of automation , smarter coding and cut down in development time . In this post I am going to use Eclipse to configure and setup the the SDK so we can start writing faster and smarter codes. Although there are many other tools to do the job , its just my preference and ease of use which made me use eclipse and write this post.

Setup Eclipse

Weblogic comes with Oracle Enterprise pack for Eclipse else you can Download the Eclipse Classic –http://www.eclipse.org/downloads/

Once Download , Extract the folder and double click the Eclipse.exe and you will be prompted for a Workspace folder. You can use the default or Create a new Folder  use as the workspace.

Workspace is where Eclipse stores all the projects.

image

Now click on the icon as shown in the image and click on the Project .

image

Select Java Project and click Next

image

Provide a Project Name and eclipse would automatically select the default JRE in case it doesn’t you can click on Configure JREs and select the java folder . Finally click Next.

image

Go to the Libraries tab and click on the Add External JAR

image

Add JAR Files

Go and find the folder in oracledi.sdklib and select all the jar files under this folder. Although the main jar is odi-core.jar but it have some link with other jar inside and in order to avoid the confusion  I have just selected all the jar inside the folder .

For my example the directory is – >

C:OracleMiddlewareOracle_ODI1oracledi.sdklib

image

Apart from the above jar files , we also need to include the database jar file where the ODI repository resides. For my example ODI Master and Work repository is on Oracle 11.2 version so ojdbc6.jar file .

image

Finally click the Finish button. Now we are ready to start our coding .

image

Creating First Code

Lets start creating out First piece of Code. Our first piece of code is to create a Project and a Folder.
To do so , Right click on Folder and select New and then Class

image

I have created a package called odi.sdk , you can use the main src or create a separate package which is recommended.

Provide the Class Name and select the option as show in the below image

image

copy paste this standard codes as this code will be the main skeleton for all ODI SDK development after this

public static void main (String [] args ) { << paste the below codes and change the connection credentials >> }

final SimpleOdiInstanceHandle odiInstanceHandle = SimpleOdiInstanceHandle.create
("jdbc:oracle:thin:@localhost:1521:XE",
"oracle.jdbc.OracleDriver",
"ODI_MASTER_11G",
"ODI_MASTER_11G",
"WORKREP1",
"SUPERVISOR",
"SUNOPSIS");

// Allocate an odisinstance of the name
final OdiInstance odiInstance = odiInstanceHandle.getOdiInstance();
try
  {
     TransactionTemplate tx = new TransactionTemplate(odiInstance.getTransactionManager());
     tx.execute(new TransactionCallbackWithoutResult()
        {
         protected void doInTransactionWithoutResult(ITransactionStatus pStatus)
         {

        /*
         *  <<  ODI SDK Codes goes here >>
         */

          } });
     }

finally
        {
         odiInstanceHandle.release();
        }

For ODI 11.1.1.3 and later

        /****** Please change these Parameters *********/

        String Url = "jdbc:oracle:thin:@localhost:1521:xe";
        String Driver="oracle.jdbc.OracleDriver";
        String Master_User="ODI_MASTER_11G";
        String Master_Pass="ODI_MASTER_11G";
        String WorkRep="WORKREP1";
        String Odi_User="SUPERVISOR";
        String Odi_Pass="SUNOPSIS";

// Connection
MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,Master_Pass.toCharArray(), new PoolingAttributes());
WorkRepositoryDbInfo workInfo = new WorkRepositoryDbInfo(WorkRep, new PoolingAttributes());
OdiInstance odiInstance=OdiInstance.createInstance(new OdiInstanceConfig(masterInfo,workInfo));
Authentication auth = odiInstance.getSecurityManager().createAuthentication(Odi_User,Odi_Pass.toCharArray());
odiInstance.getSecurityManager().setCurrentThreadAuthentication(auth);
ITransactionStatus trans = odiInstance.getTransactionManager().getTransaction(new DefaultTransactionDefinition());

        /*
         *  <<  ODI SDK Codes goes here >>
         */

// Finally close the Instance
        odiInstance.getTransactionManager().commit(trans);
        odiInstance.close();

image

As you can see some read mark on some of the codes and that is because we have not imported the required java libraries .

Importing library is just a matter of click now. Just place your mouse on the red underlined code . you will see options as shown in the image . Now click on the Import SimpleOdiInstanceHandle. Keep doing so for other underlined codes and eclipse will import automatically .

image

After doing that as you can see that eclipse has neatly and smartly import the required libraries.

image

Now go and change the connection properties and change it accordingly to connect to your Master and Work Repository.

Lets first make sure if we are connected and we can start playing around with more ODI SDK codes.

In order to test the connection and if I am connected I always use this code to test it .

OdiTechnology oracleTechnology =((IOdiTechnologyFinder)odiInstance.getTransactionalEntityManager().
getFinder(OdiTechnology.class)).findByCode("ORACLE");

System.out.println(oracleTechnology.getName());

As you can see the output will be like this , which mean the credentials are correct and now we are ready to write more codes.

image

Creating  Project, Folder and Context

Lets start with creating a Project , Folder and Context and setting the Context as Default.

Also you would need this API document in better understanding arguments to be passed.

http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e17060/toc.htm

OdiProject proj = new OdiProject("XMT", "XMT");
//OdiProject(java.lang.String pName, java.lang.String pCode)

OdiContext context=new OdiContext("XMT");
//OdiContext(java.lang.String pCode)

context.setDefaultContext(true);

Searching the Classes

Lets see how to find the required class .

To search go to the above link (http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e17060/toc.htm ) and press find depending on your browser and type odiproject and browser will show the required alternative and click the class you were looking for .

As you can see for this example i searched for odiproject and found the class OdiProject and on the right side i can see all the Methods and Constructor and use the same in writing the SDK codes.

The Constructor of the OdiProject is

OdiProject(java.lang.String pName, java.lang.String pCode).

Here i am replacing the Name and code with XMT  and so the codes will be

  • OdiProject proj = new OdiProject(“XMT”, “XMT”);

The Constructor for OdiContext is OdiContext(java.lang.String pCode)

  • OdiContext context=new OdiContext(“XMT”);

I also wanted to see the new context as the default context , so add the method setDefaultContext(boolean);

  •  context.setDefaultContext(true);

Eclipse can help you in writing the arguments .

image

Eclipse will show more method once you press (period) and as show in the below image, but we always need the help of the API so we can pass the correct arguments.

image

image

Lets Execute the code and lets see if the codes have been reflected in the ODI .

image

image

Its blank . hmm so we are missing something . We are missing the Persist .

Persist is like saving the codes into the Repository, so make sure we add the persist as required  .

Lets add the persist  and run it again.

image

As you can see the execution got successful and we can see the Project, Folder and Context  in the ODI Designer.

image image

IFinder

IFinder is used to find different ODI objects according to ODI object and there are different IFinder to find the respective ODI objects

For Ex – IOdiCKMFinder, IOdiColumnFinder, IOdiConditionFinder, IOdiContextFinder, IOdiContextualAgentMappingFinder, IOdiContextualSchemaMappingFinder

Writing the IFinder codes are very easy . Let me share with you the technique i use.

project = ((IOdiProjectFinder)odiInstance.getTransactionalEntityManager().getFinder(OdiProject.class))

Have a default template as shown above and accordingly change the Object type . Lets say if i want to search for OdiFolder

Replace the OdiProjectFinder to OdiFolderFinder and
OdiProject.class to OdiFolder.class and replace the variable project to folder etc.

Lets look at this simple example where I am using the IOdiProjectFinder to list all the project in the work repository.

// List all the projects

Object[] project = ((IOdiProjectFinder)odiInstance.getTransactionalEntityManager().
getFinder(OdiProject.class)).findAll().toArray();

 for ( int i =0 ;i <project.length ; i++ )  {
    OdiProject pro1=(OdiProject) project[i];
   // We need to cast the object project accordingly, for this example OdiProject
 System.out.println("Project Name "+pro1.getName());
}

// (or)

for (Object object : project) {
     OdiProject pro2=(OdiProject) object;
     // Here i am casting the object as OdiProject
     System.out.println("Project Name "+pro2.getName());
}

 //Reading the List of the Folder under a Project
//

 Collection fold1 = ((IOdiFolderFinder)odiInstance.getTransactionalEntityManager().
getFinder(OdiFolder.class)).findByProject("XMT");

for (Iterator iterator = fold1.iterator(); iterator.hasNext();) {
     OdiFolder object = (OdiFolder) iterator.next();
     System.out.println("Folder Name "+object.getName());
}

image

Eclipse can help to write the for loop too.

To do so

type – for and press ( control + space keys ) and eclipse will show automatically the option and since we are writing for the collection select the required for loop and change the Object to OdiFolder .

image

Creating  Data Server , Physical Schema and Logical Schema .

// Create a Data Server , Physical Schema, Logical Schema

// First lets make sure if we have the Oracle Technology

OdiTechnology oracleTechnology = ((IOdiTechnologyFinder) odiInstance
.getTransactionalEntityManager().getFinder(OdiTechnology.class)).findByCode("ORACLE");
// using the IOdiTechnologyFinder to finder the required technology
if (oracleTechnology != null) {
    oracleDataServer = new OdiDataServer(oracleTechnology,"ORCL_TARGET");

// connection settings
//Providing the  Url and Driver
oracleDataServer.setConnectionSettings(new OdiDataServer.JdbcSettings(
"jdbc:oracle:thin:@localhost:1521:orcl",
"oracle.jdbc.driver.OracleDriver"));

// UserName and Password
oracleDataServer.setUsername("HR");
oracleDataServer.setPassword(ObfuscatedString.obfuscate("HR"));
// ObfuscatedString.obfuscate will save the password in the encrypted format
}

// Creating a New Physical Schema
OdiPhysicalSchema oraclePhysicalSchema = new OdiPhysicalSchema(oracleDataServer);

// Set additional information on the schema
oraclePhysicalSchema.setSchemaName("HR");
oraclePhysicalSchema.setWorkSchemaName("ODI_TEMP_11G");

// Create the logical schema and the mapping to it in the context

OdiLogicalSchema oracleLogicalSchema = new OdiLogicalSchema(oracleTechnology, "HR");
new OdiContextualSchemaMapping(context,oracleLogicalSchema, oraclePhysicalSchema);

// Saving the Data Server , Physical and Logical Schema in  ODI

odiInstance.getTransactionalEntityManager().persist(oracleTechnology);

As we have mentioned before we need API documentation to pass the correct arguments . After execution of the above codes

as you can see that Data Server , Physical and Logical schema is created and the connection is successful.

image

image

This post was more about getting started with ODI SDK codes and as odiexperts have always tried to provide the easy tutorial to make ODI an easy experience and this post was meant to get started with configuration and setup of ODI SDK in eclipse  to write more easy and  fun SDK codes.

More SDK codes are coming soon.  🙂

The Complete code

package odi.sdk;

import oracle.odi.core.OdiInstance;
import oracle.odi.core.persistence.transaction.ITransactionStatus;
import oracle.odi.core.persistence.transaction.support.TransactionCallbackWithoutResult;
import oracle.odi.core.persistence.transaction.support.TransactionTemplate;
import oracle.odi.domain.project.OdiFolder;
import oracle.odi.domain.project.OdiProject;
import oracle.odi.domain.topology.OdiContext;
import oracle.odi.domain.topology.OdiContextualSchemaMapping;
import oracle.odi.domain.topology.OdiDataServer;
import oracle.odi.domain.topology.OdiLogicalSchema;
import oracle.odi.domain.topology.OdiPhysicalSchema;
import oracle.odi.domain.topology.OdiTechnology;
import oracle.odi.domain.topology.finder.IOdiTechnologyFinder;
import oracle.odi.domain.util.ObfuscatedString;
import oracle.odi.publicapi.samples.SimpleOdiInstanceHandle;

public class MyFirstSKDCode {

private static OdiDataServer oracleDataServer;
protected static String pStringToObfuscate;
protected static OdiContext context;

/**
* @param args
*/
public static void main(String[] args) {

final SimpleOdiInstanceHandle odiInstanceHandle = SimpleOdiInstanceHandle
.create("jdbc:oracle:thin:@localhost:1521:orcl",
"oracle.jdbc.OracleDriver",
"ODI_MASTER_11G",
"ODI_MASTER_11G",
"WORKREP1",
"SUPERVISOR",
"SUNOPSIS");

final OdiInstance odiInstance = odiInstanceHandle.getOdiInstance();
try {
TransactionTemplate tx = new TransactionTemplate(odiInstance.getTransactionManager());
tx.execute(new TransactionCallbackWithoutResult()
{
   protected void doInTransactionWithoutResult(ITransactionStatus pStatus)
   {

      //
     //  ODI SDK Codes goes here
    //

OdiProject proj = new OdiProject("XMT", "XMT");

OdiContext context = new OdiContext("XMT"); // New Context
context.setDefaultContext(true);

 // Creating a New Folder

OdiFolder fold = new OdiFolder(proj, "FOLDER");

 // Persist Project and Context

odiInstance.getTransactionalEntityManager().persist(proj);
odiInstance.getTransactionalEntityManager().persist(context);

 // create a Data Server , Physical Schema, Logical Schema

 // First lets make sure if we have the Oracle Technology

OdiTechnology oracleTechnology = ((IOdiTechnologyFinder) odiInstance
.getTransactionalEntityManager().getFinder(
OdiTechnology.class)).findByCode("ORACLE");
if (oracleTechnology != null)

{
     oracleDataServer = new OdiDataServer(oracleTechnology,"ORCL_TARGET");

    // connection settings
    oracleDataServer.setConnectionSettings(new OdiDataServer.JdbcSettings(
       "jdbc:oracle:thin:@localhost:1521:orcl","oracle.jdbc.driver.OracleDriver"));

   // UserName and Password
   oracleDataServer.setUsername("HR");
   oracleDataServer.setPassword(ObfuscatedString.obfuscate("HR"));

}

// Creating a New Physical Schema

OdiPhysicalSchema oraclePhysicalSchema = new OdiPhysicalSchema(
oracleDataServer);
// Set additional information on the schema
oraclePhysicalSchema.setSchemaName("HR");
oraclePhysicalSchema.setWorkSchemaName("ODI_TEMP_11G");

// Create the logical schema and the mapping to it in the
// context
OdiLogicalSchema oracleLogicalSchema = new OdiLogicalSchema(oracleTechnology, "HR");
new OdiContextualSchemaMapping(context,oracleLogicalSchema, oraclePhysicalSchema);

// Persist the Data Server , Physical and Logical Schema

odiInstance.getTransactionalEntityManager().persist(oracleTechnology);

System.out.println("Done");

}
});
}

finally

{
odiInstanceHandle.release();
}

}

}

March 27, 2011
by kdevendr
25 Comments

Categories: Administration , Architecture , How to , Knowledge Modules , ODI , Technology , Tips and Tricks

Tags: ,

Single Post View


CDC CONSISTENT

Hi Friends,

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

CDC Consistent is great when we have tables in a schema related to each other via PK – FK relationship, as CDC Consistent are applied on the Model rather than on the Data store level as practiced in Simple.

Please find the step by step instruction of initial set up of CDC Consistent

Step 1. Edit the Model and select the appropriate Consistent Journalizing mode and select the appropriate Consistent KM.

image

Step 2. Add the data stores into CDC.

image

image

image

As you can see the all the data stores will have the orange clock shaped icon.

Step 3. Add the subscriber(s)

image

image

image

image

Step 4– Start the Journal

image

image

image

Once the Journalizing is successful the Orange clock icon will change to Green icon.

Testing the CDC Consistent on various scenarios.

Simple Insert is being carried at the Source Table.

image

Data being shown at the Journalizing data option.

image

Lets see if the Journalized data gets flow through.

image

The records does not seems to come through . Let’s see the issue or the real reason behind it.

image

The source table for the journalizing is reading from the JV$ view, where as the data seems to be reading from the JV$D view.

The real reason behind  why ODI reads from the JV$ rather than JV$D is that JV$ captures all the records from the JV$D by locking the subscriber.

Consider this example  say  at 10 pm there are 3 Inserts , 5 Updates and 1 deletes are happening at the source side  and thus gets captured in the  respective JV$D views .

We apply the Extend windows and Lock Journalize table and all the records in the JV$D gets captured into JV$.Now at that time there is again a new 1 insert and so gets captured in the JV$D views.  Since there is lock in the subscriber table  . New data will not be captured into JV$ .

Let’s repeat the necessary steps and rerun the interface.

Step 1. Extend Window

image

image

Step 2. Lock Subscriber

image

Select the right subscriber

image

image

Step 3– Run the interface

image

Step 4 – Unlock  Subscriber

image

image

Step 5 –  Purge Journal

image

image

Once the data is been captured the journal is purged.

image

Lets see how we can process the above steps via Package.

image

Step 1 – OdiWaitforLogData

image

Apart from the default setting  provide the Logical Schema and either provide the table name or the CDC Set.

Step 2 – Extend and Lock Subscribers the model

Drag and drop the Model into the Package and in the Type select Journalizing Model

and check mark Extend windows and Lock Subscribersimage

Step 3–  Interfaces

Now call the interfaces.

Step 4 – Unlock Subscribers and Purge Journal.

Next steps after the interface drag and drop the model and select Purge Journal and Unlock Subscribers.

image

Lets test the package . I am inserting another record and let see if the records come through .

image

image

Yes data has been inserted into the Target table.

image

Single Journalized table per interface Limit.

If there are n number of Journalized table in an interface , only  one interface can be marked as Journalized data , even if they are consistent based .

image

In order to avoid this limit , I have revised the code and re written it like this, so that we can use two journalized table without requiring to read through the complete table of the other source.

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)%>

<%}%>

In order to use the above code in any KM.

Mark the parent Datastore with Journalized data store option.

Replace the code JRN_FLAG IND_UPDATE with <%=odiRef.getJrnInfo("FULL_TABLE_NAME")%>.JRN_FLAG IND_UPDATE

so it can use the Parent JRN_FLAG to accordingly drive the target.

 

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]<?}?> ", " , ", "")%>

so if the datastore is journalized then its associated JV$ view is used else the table name

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 {?><?}?> ", " ", "")%>

Here for this example i have used the hard coded  subscriber name of SUNOPSIS , you can use the getoption and pass the subscriber name in the Interface option.

The main reason for re writing it this way is that , when we have only one table as journalized , ODI have to read through the other child tables even though they are Journalized.

Lets see an example of the above code

SOURCE

ScreenClip(4)

Two new region id is inserts into Regions table with region id 7 and 8

ScreenClip(5)

Record is insert  with country _id ID  and region id 7

Looking at the combination and the Location parent driving then both will be inserted into JV$D views for the respective table.

ScreenClip(2)

ScreenClip(3)

TARGET

As you can see for the country id and region id 7 , the target table has correctly fetched the associated Region name .

ScreenClip(6)

Hope this article gives you a better understanding on the CDC Consistent type.

Thank you and please, keep visiting us.

March 2, 2011
by kdevendr
2 Comments

Categories: Administration , Architecture , Drivers , How to , Logic , ODI , Technology , Tips and Tricks

Tags: , , ,

Single Post View


Ordered SQL

Howdy, Friends…

A small but very useful tip!

There are some time we would need to process SQL (or load) via  a particular order and, to achieve that, many time the Developer would load the data into temporary tables and process them same later into Target.

We can change the way that joins are generated at Oracle Data Integrator (10g or 11g).

If we are dealing with latest Oracle database , there is option in ODI topology which when being enabled would enables us to do Ordered SQL and thus avoiding unnecessary temporary table and steps and even processing time.

To enable the Ordered SQL .

Go to Topology- > Physical Architecture – > Oracle Technology (or any technology you wish to change)

image

image

Interface

image

image

The option of the Ordered Join syntax is to be enabled and accordingly the order Number needs to specified.

ODI will process the joins based on the Order Number and also in the Ascending Order.

image

TABLE LENGTH

Just to add to the above technique , you can set the table length in the Technology settings.

image

Good to see you around… keep visiting us!

February 13, 2011
by Cezar Santos
9 Comments

Categories: Architecture , How to , Logic , ODI , Tips and Tricks

Tags: , , ,

Single Post View


Killing session in ODI 11g

Hi everyone…

This post is about a something new on ODI 11g…

I must confess that  when I saw the first time I didn’t get the concept but now, it’s more clear!

I hope you all enjoy!

In ODI 10g we had this big issue of killing the job especially its big headache when we need to ping or disturb DBA . ODI 11g seems to handle this situation smartly by introducing new options called STOP NORMAL and STOP IMMEDIATE.

You can find this option under the running session.Lets look how this two options work.

image

STOP NORMAL

I am killing the running session using the option STOP NORMAL. The SID for this query is 143  and so I right click and click on Stop Normal

image

A pop up will be shown for  Stop Session dialogue and click OK to kill it.

image

After running a few test I have seen that Stop Normal takes time to kill the session and  after a while we get the Session Stopped dialogue. Generally in the Normal  kill command,  Oracle marks the query with status of Kill so most of the time the Oracle will wait for the operation or query to be processed and mark the query as Killed and pretty much the similar logic is being carried out for the STOP NORMAL, so this kill operation takes time.

image

image

My SID query also return nothing as the Session is killed in the Database too.

STOP IMMEDIATE

image

Similar to the Stop Normal the  Stop Immediate will ask the permission to be killed or not . Click OK for the confirmation.

image

Being an Immediate clause ,  the query is killed immediately.

image

Note:- This process can only work when the User used in Topology have the necessary Kill  permissions.

That is it! I hope be useful to all of you!

Thanks for visiting us!

January 25, 2011
by Cezar Santos
0 comments

Categories: Administration , Architecture , How to , Logic , ODI , Tips and Tricks

Tags: , , , ,

Single Post View


11g Oracle Data Integrator – Part 8/11g – Table Partitioning supported

Hi everyone…

Some new features on Oracle Data Integrator 11g. A lot of  “Oracle people” will enjoy it even that still needs some improvements…

We have seen that in ODI 11g the support for table partition . We wanted to see the ability and support and recognition of it , so we have done some sample run through test and here we are sharing what we have seen .

Here we are creating a Partition based table.

CREATE TABLE EMPLOYEES
(EMPLOYEE_ID NUMBER(6,0),
SALARY NUMBER(8,2),
COMMISSION_PCT NUMBER(2,2),
MANAGER_ID NUMBER(6,0),
DEPARTMENT_ID NUMBER(4,0) )
PARTITION BY RANGE (EMPLOYEE_ID)
( PARTITION P1 VALUES LESS THAN (120) TABLESPACE USERS ,
PARTITION P2 VALUES LESS THAN (140) TABLESPACE USERS,
PARTITION P3 VALUES LESS THAN (160) TABLESPACE USERS,
PARTITION P4 VALUES LESS THAN (200) TABLESPACE USERS ,
PARTITION P5 VALUES LESS THAN (MAXVALUE) TABLESPACE users);

After running the script in database , We have used the selective reverse and have found that it failed to recognizing the partition, so we reran the reverse using the RKM Oracle.

clip_image002

The Oracle RKM successfully recognized and captured the Partition and was able to see in the Datastore also as a standard practice its always great to go for Oracle RKM.

clip_image004

Since database handles the partition allocation, handling the insert was easy task.

clip_image006

SELECT * FROM EMPLOYEES PARTITION (P1);

clip_image008

Now creating a temporary interface with partition on it and loading the data

we also wanted to check if the Create table can create a partition based table and we have created database structure with the required partition type and values and used the same into the target.

clip_image016

clip_image018

clip_image020

clip_image022

clip_image024

As you can see the Create table was created without Partition, so still the KM don’t have the support to handle the partition and would need to be created via either database or Generate DDL and run the same in the target.

clip_image030

clip_image026

 Well, as I told at the beginning still needs some improvements but already useful.

Thank you for visit us!!!!

January 17, 2011
by Cezar Santos
7 Comments

Categories: Administration , Common Errors , How to , ODI , ODI Bug

Tags: , , , , ,

Single Post View


Jython Scripts fails to recognize the module during scenario run in ODI 11g

Hi Friends!

2011… we are back! 😉

During a recent Oracle forum question i was looking at an interesting question where the user said the ODI Scenarios throws the error ‘ No module names re ‘ . Initially i thought might be the user is making some mistake but then he also wrote ‘the codes are working perfectly in the Designer’. Strange .

I thought let me do a faster run in ODI 11g and check if that is really the case and I wrote a small Jython procedure based on ‘re’ module and ran via designer no issue. Now i made the scenario and ran via startscen . Hmm same error as the user reported.

I thought ok it looks like some issue with odiparams and initial scan made me realize that path is taking <WEBLOGIC_HOME>Oracle_ODI1oraclediagent as ODI_HOME and its reading directories in it namely lib,drivers and bin . I drilled and started looking for other such path and found that <WEBLOGIC_HOME>Oracle_ODI1oracledi.sdklib had the Jython.jar and folder Lib had required Jython module , which gave me the hint that becuase of odiparams the startscen is reading from the agent directory and there is no Jython modules present so i copied the folder to under lib/Lib with all the modules and re ran the scenarios and it worked. 🙂

Although i thought of changing the path of odiparams but then it might cause other links broken so copying the Lib folder from Oracle_ODI1oracledi.sdklib to Oracle_ODI1oraclediagentlib is the easiest solution.

Thank you for following ODIExperts.com

January 10, 2011
by Cezar Santos
6 Comments

Categories: Administration , Architecture , How to , ODI , Tips and Tricks

Tags: , , , , , ,

Single Post View


Scenarios, a lot in the first delivery makes maintenance very simple!

Hi Everyone!

First I wish to all of you a really Happy New Year! I hope that 2011 can be the best year ever to all of us!

Second, sorry, sorry and sorry. We “abandoned” our blog this last few weeks. I got a lot of new responsibilities on my formal job and Dev was in vacation with his family. We are going to try to be more present from now forward.

Third (and last) let’s talk about scenarios!

I created this title “Scenarios, a lot in the first delivery makes maintenance very simple!” in the hope of a full understanding about what this post is in just one phrase once I would like that after we finish to discuss it you can tell me if the title is right or not…

I Oracle Data Integrator, our famous ODI, is very common to develop all objects that you need to your integration and, at end of the development, add all of these at a package, create a scenario and that is it. Test and go to production.

That is the common way in all ODI environments that I saw until today… let’s discuss this.

When we are developing a it’s normal to have several tables to load in some order (parents, children, etc), procedures to performs some “not interfaceble” task and variables that uses code (refreshing type). Then, all we do is add all of this in a package, generate de scenario and our development is done.

OK, now let’s think about it from the Software Development Life Cycle (SDLC)  perspective, I mean, everything that is developed will get some maintenance in one of his “pieces” some day.

As we change just one piece from all our package, of course we should test just that piece right?

NO!  And here is the problem!

Who can guarantee that none of the others pieces (or ODI objects) was changed? In fact, using a trusted SDLC, you need to execute the complete test plan (the same that allows the first delivery) once all code was “compiled”, I mean, regenerated (in ODI terms).

Do you agree?

And if we split the development in small pieces of scenarios, as small as possible, even at object level (as we can generate scenarios from objects ) and then create a package (or packages) that orchestrate the execution of this small pieces????

Of course that the first delivery will have a lot of scenarios to be imported at production but when some change is necessary you can update only the relevant code and, too, test only it.

In this way your SDLC will get less errors and the cost (HR, Financial, Hardware, etc) of tests will decrease substantially and plus, you can always re-use any of the object scenario.

If you pay attention, you will see that we are talking about the old concept of Object Orientation, nothing new.

And now, what do you think? Is the title right? 🙂

A tip to use this approach is to have the Operator (scenarios tab) organized in folders. This will avoid the endless list of scenarios and brings organization to the environment.

Well friends, that’s all for now. I hope you keep traking us!

Once again, Happy 2011!!!!

Cezar Santos

December 3, 2010
by Cezar Santos
15 Comments

Categories: Architecture , Logic , ODI , Tips and Tricks

Tags: , , , ,

Single Post View


Direct load by interface with no work tables (C$, I$)

Hi friends…

I got this video from Craig Stewart that shows us how to direct load data from source to target with no work (C$ and I$) table use.

http://s3.amazonaws.com/Ora/ODI-Simple_SELECT_and_INSERT-interface.swf

Simple, fast and very clever!

Thank you for share your expertize Craig!

November 16, 2010
by Cezar Santos
0 comments

Categories: Administration , Architecture , Drivers , How to , Logic , ODI , Tips and Tricks

Tags: , , , , ,

Single Post View


11g Oracle Data Integrator – Part 7/11g – SUNOPSIS MEMORY ENGINE

Hello everyone.

As this is a feature that comes from 10g but still present at 11g and pretty useful, we decide to discuss it as “11g part”. You will see that it’s really useful in several situations.

We all have seen the Sunopsis Memory Engine but have never used it or played with it. This post is all about it and using it smartly for various activities, without using target RDBMS for temporary activities.

If you are wondering what actually is Sunopsis Memory Engine , its nothing but the HyperSQL , which is an 100% java database. The Demo environment  runs on the HyperSQL.

[ Note : HyperSQL stores its data in memory ,so once the ODI is closed and restarted the data and the tables are flushed out ,so HyperSQL is great for storing or processing data for a particular session ]

ScreenClip(3)

You can find more about it here http://hsqldb.org/ and Documentation at this link – http://hsqldb.org/web/hsqlDocsFrame.html

we believe that Sunopsis Memory engine can be great for creating temporary table or storing data temporarily for ODI logic implementation.

Lets look at various implementation uses and method.

For ODI 10G ,  Technology  – Sunopsis Engine and Schema – SUNOPSIS_MEMORY_ENGINE

For ODI 11G , In-Memory Engine and Schema – SUNOPSIS_MEMORY_ENGINE

create table temp_table ( id INTEGER, name varchar(20))
insert into temp_table values ( 1 ,’abc’)
insert into temp_table values ( 2 ,’abcd’)
insert into temp_table values ( 3 ,’abcdef’)

ScreenClip

Calling it in the Variable

Similar to any RDBMS you can call these tables into the Variable too , just select the SCHEMA as SUNOPSIS_MEMORY_ENGINE and write your query.

For example select id from temp_table.

ScreenClip(1)

ScreenClip(2)

Similar to Oracle , you can read it via Jython or Java and fetch the required information.

If you ever need to read the data from File via jython or Java and write into Sunopsis Memory. Here are the codes.

Jython.

import java.sql as sql
import java.lang as lang
sourceConnection = odiRef.getJDBCConnection("SRC")
sqlstring = sourceConnection.createStatement()
read_file=open('c://table_name.txt','r')
read_line=read_file.readline()
while read_line:
     sqlstring.executeUpdate("INSERT INTO TABLE_NAME VALUES ('"+read_line+"')")
     read_line=read_file.readline()

sourceConnection.close()
read_file.close()

Java

<@
import java.io.*;
import java.sql.*;
sourceConnection = odiRef.getJDBCConnection("SRC") ;
sqlstring = sourceConnection.createStatement();
FileInputStream fstream = new FileInputStream("C:/table_name.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;    
while ((strLine = br.readLine()) != null)   {
            sqlstring.executeUpdate ("INSERT INTO table_name values('"+strLine+"')") ;
}    
in.close();
sourceConnection.close();
@>

Temporary Data storage.

Some time we would like to store the data into Temporary purpose for testing or debugging purpose.

image

We can also reverse engineer the table using the select reverse too.

image

If you want to play with via  external Sql editor ,you can access the jar file located at  <ODI_HOME>oraclediagentlib   hsqldb.jar  for ODI 11g image

Now you can use it as you wish!!!

Please, keep visintig us!