Wednesday, 7 September 2011

Transfer data from one Flat File to another Relational Table.

 

Open your SQL DEVELOPER and connect to the Administrator role.

Create the new schema/user by executing the following SQL commands:

Create user ODI_STAGE identified by oracle1

default tablespace users temporary tablespace temp;

Grant connect, resource, create trigger, create view to ODI_STAGE;

clip_image002

Now connect to your schema by mentionaing ODI_STAGE as user and oracle1 as password.

clip_image004

Now Create table in ODI_STAGE schema by executing following query in SQL Developer.

CREATE table "TRG_SALES_PERSON"(

"SALES_PERSON_ID" NUMBER (8, 0) NOT NULL,

"FIRST_NAME" VARCHAR2 (80),

"LAST_NAME" VARCHAR2 (80),

Constraint "TRG_SALES_PERSON_PK" primary key ("SALES_PERSON_ID")

)

clip_image006

Now create a project in ODI Suit. And name the project as ODIExp_FT_RT and save the changes.

clip_image008

Also import IKM SQL Incremental Update Knowledge module

clip_image010

Now import the Knowledge module LKM File to SQL .

clip_image012

Now go to Oracle technology under Physical Architecture and right click and select New Data Server.

clip_image014

Name the Data Server as ODI_STAGE. And specify the instance as localhost , User as ODI_STAGE and password as oracle1.

clip_image016

Then go to JDBC tab and specify the driver and url.

clip_image018

Save the result and click ok on dialogue that appears for physical schema.

clip_image020

Now right click on Data Server that is newly created and select new physical schema option.

clip_image022

Fill out the required detail that is Directory as ODI_STAGE and Directory (Work Schema) as ODI_STAGE. Save the changes and click ok on dialogue that appers to specify the context.

clip_image024

Now go to Logical Architecture tab and right click on the Oracle technology and select New Logical Schema.

clip_image026

Name the Logical schema as ODI_STAGE and set the physical schema for the context inside logical schema window.

clip_image028

clip_image030

Now go to Designer tab and click on the icon in Model window and select New Model Folder.

clip_image032

Name the Folder as RDBMS and save the changes.

clip_image034

Right click on the folder just created and select New Model option.

clip_image036

Name the Model as Oracle_RDBMS1 and select technology as Oracle and logical schema as ODI_STAGE.

clip_image038

Now right click on model just created and select Reverse Engineer.

clip_image040

clip_image042

Now go to File technology and create and create a physical schema for our file.

clip_image044

clip_image046

Create logical schema for the file.

clip_image048

clip_image050

clip_image052

Now create a model folder in model tab.

clip_image054

clip_image056

Now create a new model inside files folder.

clip_image058

Create a DataStore inside model of file.

clip_image060

Selct the SRC_SALES_PERSON.TXT as Resource Name.

clip_image062

Now switch to Files tab and select File Format as Fixed.

clip_image064

Now select Reverse Engineer icon inside Column tab of DataStore window.

clip_image066

Point the cursor, and then click the ruler at the beginning of each column as shown below. The wizard marks each column.

clip_image068

After the columns are marked, click each column data and set the Name and Data type for each column. Click OK when you have finished.

clip_image070

Right click on data store newly created and select view data option.

clip_image072

You can see the data inside file.

clip_image074

Now go to your Project and select Interface option. Right click on Interface icon and create a new Interface.

clip_image076

Name the interface as INT-EXP-FF-RT .

clip_image078

Now go to Mapping tab and drag and drop the SRC_SALES_PERSON datastore from the Files folder into the Sources container. Drag the TRG_SALES_PERSON datastore from Files into the Target Datastore container.

When Designer asks "Do you want to perform an Automatic Mapping?" click Yes. The Diagram tab should look as follows. Click the Flow tab.

clip_image080

Click the SS_0 (1 - FILE_GENERIC) source datastore. This makes the properties for the source appear below. In the LKM Selector section, select LKM File to SQL from the LKM drop-down list if not already selected.

Click Target (FILE_GENERIC). This makes the properties for the target appear below. For IKM, select IKM SQL Incremental Update from the IKM drop-down list if not already selected.

clip_image082

clip_image084

Now right click on the interface and select the execute option.

clip_image086

The following screen appears. Retain the defaults and click OK. On the screen that follows, click OK.

clip_image088

Click Ok.

clip_image090

To verify that your interface was executed successfully, you need to open ODI Operator. Click the ODI Operator tab. In ODI Operator, click Hierarchal Sessions. Expand Date > Today > INT_exp_FF_RT > Steps > INT_exp_FF_RT, and view the execution results for each step. Double-click any step and click the Description and Execution tabs to see the execution results.

clip_image092

To verify the result connect to ODI_STAGE user and execute the following SQL command:

Select * from TRG_SALES_PERSON;

You can see that data is inserted successfully.

clip_image094

No comments:

Post a Comment