Вы находитесь на странице: 1из 28

ODI11g: Creating an ODI Project and Interface: Exporting a Flat File to a Flat File

Note: Instructions and any text that you need to modify are enclosed in <>.

Purpose
This tutorial walks you through the steps that are needed to create a project and an interface in Oracle Data Integrator (ODI) to export a flat file to another flat file.

Ti e to Co plete
Approximately ! minutes

O!er!ie"
A common task that is performed using ODI is to export data from a flat file and load this data into another flat file. This tutorial walks you through the steps that are needed to create a project and an interface that will import a file to a staging area" perform some minor transformations" and then write the data to a file. #ou also execute the interface and $erify the execution using ODI Operator.

#cenario
%inda works as a data&ase administrator for 'lo&al (nterprise. In 'lo&al (nterprise" %inda is responsi&le for performing data&ase management and integration tasks on $arious resources within the organi)ation. In particular" %inda is responsi&le for data loading" transformation" and $alidation. To &egin working on her projects" %inda created the new *aster repository and +ork repository. ,ow %inda needs to create a project and an interface to export data from a flat file" perform transformations" and load this data into another flat file.

#oft"are and $ard"are %e&uire ents 'Optional(


The following is a list of software re-uirements.

o o

The system should include the following installed products. Oracle Data&ase //g Oracle Data Integrator //g0/ If not done &efore" start the ser$ices and components for Oracle Data&ase //g

Prere&uisites
1efore you start the tasks" make sure that your system en$ironment meets the following re-uirements. 1 ) 2a$e installed Oracle Data&ase //g. If not done &efore" start the ser$ices and components for Oracle Data&ase //g * ) 2a$e installed Oracle Data Integrator //g0/ + ) 1efore attempting this O1(" you should ha$e successfully completed the following O1(. ODI11g: Creating and Connecting to ODI Master and Work Repositories. To access this O1(" click HERE.

Creating a New Project with Oracle Data Integrator


To create a new project within Oracle Data Integrator" perform the following steps. 3tart ODI Designer. #tart 4 Progra s 4 Oracle 4 Oracle Data Integrator 4 ODI #tudio . 3elect ,O%-%EP1 from 1) the %ogin ,ame drop5down list if not already selected. (nter #.PE%/I#O% in the 6ser field and #.NOP#I# in the 7assword field. 8lick O- to login.

*)

In the designer ta&" click the Projects ta&" click ,ew 7roject icon

" and then click Ne" Project.

On the screen that appears" set the Na e of the project to ODIexp0%T0%T in the Na e field. The Code field is filled +) automatically. 8lick #a!e icon . The newly created ODIexp0%T0%T project now appears in the 7rojects tree

$iew. #ou ha$e now successfully added a new ODI project.

9or this interface" %inda has to import a flat file into the 3:% staging area" and then export the file to a different flat 1 ) file. The -no"ledge 2odules '-2s( that are re-uired for this are 3-2 File to #43 and I-2 #43 to File 5ppend. To import the ;*s" click the Project ta& in the left panel and expand the -no"ledge 2odules folder. 0ight5click 3oading '3-2( and select I port -no"ledge 2odules.

Note: In this example" the generic 3:% ;*s are used. 2owe$er" specific ;*s for the 0D1*3 technology can &e used as well.

On the screen that follows"in the File Na e7 na$igate to x l8reference directory as shown in the following 6 ) screenshot. 8lick Open.The files to import should appear in the I port -no"ledge 2odules window. 7ress and hold the 8T0% key to select I-2 #43 to File 5ppend and 3-2 File to #43. 8lick O-.

On Import 0eport window" click Close. (xpand the 3oading '3-2( and Integration 'I-2( folders" and $iew each 9) imported ;* in the tree $iew as shown &elow.

Creating a New Physical Schema for the Flat File Model

To create a 7hysical schema for a new flat file model" perform the following steps. 1 ) 8lick Topology ta&. In Topology na$igator" click the 7hysical Architecture ta&" select Technologies 4 9ile. 0ight5 click 9I%(<'(,(0I8" and then select ,ew 7hysical 3chema.

* ) 9or the Directory (3chema) and Directory (+ork 3chema) fields" enter the path to the directory" where your input flat files are located ( 8.=Oracle=*iddleware=Oracle<ODI/=oracledi=demo=file ). 3elect Default check &ox" and then click 3a$e &utton. 8lose editing window for your new physical schema. On the Information window that follows" click O;. >erify that your new 7hysical schema was added under the 9I%(<'(,(0I8 data ser$er in the Technologies tree $iew.

+ ) .Open %ogical Architecture" na$igate to Technologies 4 9ile" right5click 9ile and select ,ew %ogical 3chema. (nter the %ogical 3chema name. 9%AT<9I%(3<308" select the your nely created physical schema in 'lo&al context as shown &elow. 8lick 3a$e and close the editing windows.

Creating a New ODI Model for the Flat File Source


To create a new model for the flat file target datastore" perform the following steps. . 8lick the 2odels ta& in the left panel of ODI Designer. 8lick the Insert 2odel Folder icon" and then select ,ew 1) *odel 9older. On the screen that appears" set the ,ame to Files. 8lick #a!e icon.

0ight5click the Files model folder and select Ne" 2odel. On the screen that appears" enter the $alues pro$ided in *) the following ta&le. 3elect %e!erse Engineer ta&. 7arameter ,ame Technology %ogical 3chema >alue Flat_File_1 File FILE_DEMO_SRC

On the screen that appears" $erify settings and click #a!e icon to sa$e your model . $ery that your newly created +) model appeared in the tree $iew under 9iles node.

Creating a New ODI Source Datastore for use with ODI Interface
To create a new ODI source datastore" perform the following steps. (xpand the 9lat 9iles folder" right5click the newly created Flat0File01 model" and then select Ne" Datastore. On the 1) screen that appears" set Na e to #%C0#53E#0PE%#ON. 8lick the &utton 3elect the #%C0#53E#0PE%#ON)txt file and click Open. next to the %esource Na e field.

Note: In this O1(" you use the sample files that are deli$ered with the ODI installation.

8lick the Files ta&. 3et the File For at to Fixed" and then click the Colu ns ta&. *)

On the Colu ns ta&" click the %e!erse Engineer &utton. The following screen appears. 8lick :es.. The Colu n + ) #etup ,i;ard appears.

7oint the cursor" and then click the ruler at the &eginning of each column as shown &elow. The wi)ard marks each 1 ) column.

After the columns are marked" click each column data and set the Na e and Datat<pe for each column. 9or the 6 ) names and data types of each column" refer to the following ta&le. 8lick O- when you ha$e finished. 8olumn 8/ 8? 8@ 8 ,ame 3A%(3<7(03O,<ID 9I03T<,A*( %A3T<,A*( DAT(<2I0(D Data Type numeric string string string

The columns should now look as follows. 8lick O- to sa$e the model. (xpand Files 49lat< File1 4 9 ) #%C0#53E#0PE%#ON '#%C0#53E#0PE%#ON)txt( 4 Colu ns to $iew your source model. >erify that the columns were successfully created as shown in the screenshot.

Note: If the columns ha$e not &een created" edit the newly created datastore. right5click the #%C0#53E#0PE%#ON datastore" select (dit" and repeat steps @" " A" and B. In the Flat0File01 model" right5click #%C0#53E#0PE%#ON datastore" and then select >iew Data option. 8lose all = ) ta&s.

Creating a New ODI Target Datastore for use with ODI Interface
To create a new ODI target datastore" perform the following steps. 1) In this O1(" you use the sample files that are deli$ered with the ODI installation. 1rowse to the ODI0$O2E>de o>file directory (C:>Oracle>2iddle"are>Oracle0ODI1>oracledi>de o>file). *ake a copy of the #%C0#53E#0PE%#ON)txt file and name the copy T%?0#53E#0PE%#ON)txt as shown in the example in the following screenshots.

*) In ODI Designer" right5click the newly created source datastore #%C0#53E#0PE%#ON and select Duplicate. On the screen that follows" click :es. The new Cop< of #%C0#53E#0PE%#ON)txt appears in the tree $iew.

+ ) 0ight5click the newly created duplicate Cop< of #%C0#53E#0PE%#ON)txt and select Edit. On the screen that appears" set the Na e to T%?0#53E#0PE%#ON. 8lick the &utton next to the %esource Na e field.

Note: The 9iles ta& and 8olumns ta& do not need to &e changed &ecause they are duplicated from the source file

1 ) 3elect the T%?0#53E#0PE%#ON)txt file and click Open. 8lick #a!e icon. The datastores for the source and target files ha$e now &een successfully created in the same model and can &e used in an ODI interface. 8lose editing ta&s.

Creating a New ODI Interface for Flat File to Flat File Transformations
To create a new interface" perform the following steps. 1) In ODI Designer" click the Projects ta&. (xpand your project ODIexp0%T0%T" and then expand First Folder. 0ight5click Interfaces and select Insert Interface.

*) On the screen that follows" enter the interface name as INT0exp0FT0FT. 3elect In82e or< Engine: #.NOP#I#02E2O%:0EN?INE from drop5down list. 8lick the 2apping ta&. If the $elp screen appears" click O-.

Note: 9or this O1(" we will use the 3unopsis *emory (ngine as our staging area &ecause we want to perform some transformations on the imported data.

+ ) 8lick the 2odels ta& to drag the source and target to Designer. (xpand Files 4 Flat0File01 and drag the #%C0#53E#0PE%#ON datastore from the Files folder into the #ources container. Drag the T%?0#53E#0PE%#ON)txt datastore from Files into the Target Datastore container. +hen Designer asks CDo <ou "ant to perfor an 5uto atic 2apping@C click :es. The Diagram ta& should look as follows. 8lick the Flo" ta&. Note: 9or the purposes of this tutorial" default mappings are used" although a num&er transformation can &e performed in the mapping. The mapping should &e performed in the staging area.

1 ) 8lick the ##0A '1 8 FI3E0?ENE%IC( source datastore. This makes the properties for the source appear &elow. In the 3-2 #elector section" select 3-2 File to #43 from the %;* drop5down list if not already selected.

6 ) 8lick Target 'FI3E0?ENE%IC(. This makes the properties for the target appear &elow. 9or I-2" select I-2 #43 to File 5ppend from the I-2 drop5down list if not already selected. 3et the I;* options T%.NC5TE to True and ?ENE%5TE0$E5DE% to False as shown &elow. 8lick #a!e icon to sa$e your interface .

9)

To test your interface" click Execute icon the screen that follows" click O-.

. The following screen appears. 0etain the defaults and click O-. On

= ) To $erify that your interface was executed successfully" you need to open ODI Operator. 8lick the ODI Operator ta&. In ODI Operator" click 2ierarchial 3essions. (xpand Date 4 Toda< 4 INT0exp0FF0FF > #teps > INT0exp0FF0FF" and $iew the execution results for each step. Dou&le5click any step and click the Description and Execution ta&s to see the execution results. Dou&le5click step B. >iew the num&er of rows that are inserted into the target flat file. 8lick O-. 8lose the ta&s.