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

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

Oracle Technology Network

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 <>. This tutorial contains the following sections: Purpose Time to Complete Overview Scenario Software and Hardware Requirements (Optional) Prerequisites Creating a New Project with Oracle Data Integrator Creating a New Physical Schema for the Flat File Model Creating a New ODI Model for the Flat File Source Creating a New ODI Source Datastore for use with ODI Interface Creating a New ODI Target Datastore for use with ODI Interface Creating a New ODI Interface for Flat File to Flat File Transformations Summary Resources

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.

Time to Complete
Approximately 40 minutes

Overview
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. You also execute the interface and verify the execution using ODI Operator.

Scenario
Linda works as a database administrator for Global Enterprise. In Global Enterprise, Linda is responsible for performing database management and integration tasks on various resources within the organization. In particular, Linda is responsible for data loading, transformation, and validation. To begin working on her projects, Linda created the new Master repository and Work repository. Now Linda 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.

Software and Hardware Requirements (Optional)


The following is a list of software requirements: The system should include the following installed products: Oracle Database 11g Oracle Data Integrator 11gR1 If not done before, start the services and components for Oracle Database 11g

Prerequisites
Before you start the tasks, make sure that your system environment meets the following requirements: 1 . Have installed Oracle Database 11g. If not done before, start the services and components for Oracle Database 11g 2 . Have installed Oracle Data Integrator 11gR1 3 . Before attempting this OBE, you should have successfully completed the following OBE: Creating and Connecting to ODI Master and Work Repositories. To access this OBE, click HERE.

Creating a New Project with Oracle Data Integrator


To create a new project within Oracle Data Integrator, perform the following steps:

1 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

1. Start ODI Designer: Start > Programs > Oracle > Oracle Data Integrator > ODI Studio . Select WORKREP1 from the Login Name drop-down list if not alre selected. Enter SUPERVISOR in the User field and SUNOPSIS in the Password field. Click OK to login.

2.

In the designer tab, click the Projects tab, click New Project icon

, and then click New Project.

3. On the screen that appears, set the Name of the project to ODIexp_RT_RT in the Name field. The Code field is filled automatically. Click Save icon created ODIexp_RT_RT project now appears in the Projects tree view. You have now successfully added a new ODI project.

2 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

4 For this interface, Linda has to import a flat file into the SQL staging area, and then export the file to a different flat file. The Knowledge Modules (KMs) . required for this are LKM File to SQL and IKM SQL to File Append. To import the KMs, click the Project tab in the left panel and expand the Knowledge Modules folder. Right-click Loading (LKM) and select Import Knowledge Modules.

Note: In this example, the generic SQL KMs are used. However, specific KMs for the RDBMS technology can be used as well.

5 On the screen that follows,in the File Name, navigate to xml-reference directory as shown in the following screenshot. Click Open.The files to import should . appear in the Import Knowledge Modules window. Press and hold the CTRL key to select IKM SQL to File Append and LKM File to SQL. Click

3 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

6. On Import Report window, click Close. Expand the Loading (LKM) and Integration (IKM) folders, and view each imported KM in the tree view as shown belo

4 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

Creating a New Physical Schema for the Flat File Model


To create a Physical schema for a new flat file model, perform the following steps:

7 Click Topology tab. In Topology navigator, click the Physical Architecture tab, select Technologies > File. Right-click FILE_GENERIC, and then select New Phy . Schema.

8 For the Directory (Schema) and Directory (Work Schema) fields, enter the path to the directory, where your input flat files are located ( C:\Oracle\Middleware . \Oracle_ODI1\oracledi\demo\file ). Select Default check box, and then click Save button. Close editing window for your new physical schema. On the Informatio window that follows, click OK. Verify that your new Physical schema was added under the FILE_GENERIC data server in the Technologies tree view.

5 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

9 .Open Logical Architecture, navigate to Technologies > File, right-click File and select New Logical Schema. Enter the Logical Schema name: FLAT_FILES_SR . select the your nely created physical schema in Global context as shown below. Click Save and close the editing windows.

6 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

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: .

1. Click the Models tab in the left panel of ODI Designer. Click the Insert Model Folder icon, and then select New Model Folder. On the screen that appears, se

7 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

2. Right-click the Files model folder and select New Model. On the screen that appears, enter the values provided in the following table. Select Reverse Engine Parameter Name Technology Logical Schema Value Flat_File_1 File FILE_DEMO_SRC

3. On the screen that appears, verify settings and click Save icon to save your model . very that your newly created model appeared in the tree view under Files

8 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

Creating a New ODI Source Datastore for use with ODI Interface
To create a new ODI source datastore, perform the following steps: 1. Expand the Flat Files folder, right-click the newly created Flat_File_1 model, and then select New Datastore. On the screen that appears, set Name Resource Name field. Select the SRC_SALES_PERSON.txt file and click Open. Note: In this OBE, you use the sample files that are delivered with the ODI installation.

9 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

2. Click the Files tab. Set the File Format to Fixed, and then click the Columns tab.

3 On the Columns tab, click the Reverse Engineer button. The following screen appears. Click Yes.. The Column Setup Wizard appears. .

10 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

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

11 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

5 After the columns are marked, click each column data and set the Name and Datatype for each column. For the names and data types of each column, refer . finished. Column C1 C2 C3 C4 Name SALES_PERSON_ID FIRST_NAME LAST_NAME DATE_HIRED Data Type numeric string string string

12 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

13 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

6 The columns should now look as follows. Click OK to save the model. Expand Files >Flat_ File1 > SRC_SALES_PERSON (SRC_SALES_PERSON.txt) . columns were successfully created as shown in the screenshot.

14 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

Note: If the columns have not been created, edit the newly created datastore: right-click the SRC_SALES_PERSON datastore, select Edit, and repeat steps 3

7 In the Flat_File_1 model, right-click SRC_SALES_PERSON datastore, and then select View Data option. Close all tabs. .

15 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

Creating a New ODI Target Datastore for use with ODI Interface
To create a new ODI target datastore, perform the following steps: In this OBE, you use the sample files that are delivered with the ODI installation. Browse to the ODI_HOME\demo\file directory (C:\Oracle 1. \Middleware\Oracle_ODI1\oracledi\demo\file). Make a copy of the SRC_SALES_PERSON.txt file and name the copy TRG_SALES_PERSON.txt as shown in the example in the following screenshots.

16 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

2. In ODI Designer, right-click the newly created source datastore SRC_SALES_PERSON and select Duplicate. On the screen that follows, click Yes. The new Copy of SRC_SALES_PERSON.txt appears in the tree view.

3 Right-click the newly created duplicate Copy of SRC_SALES_PERSON.txt and select Edit. On the screen that appears, set the Name to . TRG_SALES_PERSON. Click the button next to the Resource Name field. Note: The Files tab and Columns tab do not need to be changed because they are duplicated from the source file

17 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

4 Select the TRG_SALES_PERSON.txt file and click Open. Click Save icon. The datastores for the source and target files have now been . successfully created in the same model and can be used in an ODI interface. Close editing tabs.

18 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

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 tab. Expand your project ODIexp_RT_RT, and then expand First Folder. Right-click Interfaces and select Insert Interface.

2. On the screen that follows, enter the interface name as INT_exp_FT_FT. Select In-Memory Engine: SUNOPSIS_MEMORY_ENGINE from drop-down list. Click the Mapping tab. If the Help screen appears, click OK.

Note: For this OBE, we will use the Sunopsis Memory Engine as our staging area because we want to perform some transformations on the imported data.

19 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

3 Click the Models tab to drag the source and target to Designer. Expand Files > Flat_File_1 and drag the SRC_SALES_PERSON datastore from . the Files folder into the Sources container. Drag the TRG_SALES_PERSON.txt 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. Note: For the purposes of this tutorial, default mappings are used, although a number transformation can be performed in the mapping. The mapping should be performed in the staging area.

4 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.

5 Click Target (FILE_GENERIC). This makes the properties for the target appear below. For IKM, select IKM SQL to File Append from the IKM . drop-down list if not already selected. Set the IKM options TRUNCATE to True and GENERATE_HEADER to False as shown below. Click Save icon to save your interface .

20 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

6 . To test your interface, click Execute icon OK.

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

7 To verify that your interface was executed successfully, you need to open ODI Operator. Click the ODI Operator tab. In ODI Operator, click . Hierarchial Sessions. Expand Date > Today > INT_exp_FF_FF > Steps > INT_exp_FF_FF, and view the execution results for each step. Double-click any step and click the Description and Execution tabs to see the execution results. Double-click step 6. View the number of rows that are inserted into the target flat file. Click OK. Close the tabs.

21 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

Summary
In this tutorial, you have learned how to: Verify the Prerequisites Create a New Project with Oracle Data Integrator Create a New ODI Model for the Flat File Source Create a New ODI Source Datastore for Use with ODI Interface Create a New ODI Target Datastore for Use with ODI Interface Create a New Interface with Oracle Data Integrator for a flat file to a flat file data transformation

Resources
Oracle Data Intergator 11g Documentation To learn more about , refer to additional OBEs on the OTN Web site (can link to a specific set of OBEs on the subject)

User Comments
Title: Please log in or register first Post anonymously

22 of 23

3/23/2012 6:42 PM

Creating an ODI Project and Interface: Exporting a Flat File to a Flat File http://st-curriculum.oracle.com/obe/fmw/odi/odi_11g/ODIproject_ff-to-...

By submitting a comment, you confirm that you have read and agreed to the terms and conditions. This feedback form is for tutorial corrections and suggestions. Because of the volume of suggestions, we cannot reply to every comment. In particular: If you have general questions about this Oracle software product, consult the OTN forums instead. If you are encountering a software problem and need to request support or consulting, file a service request on My Oracle Support. If you want to order hardcopy documentation, go to the Oracle Store.
(Comments are moderated and will not appear immediately.)
About Oracle | | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Your Privacy Rights

23 of 23

3/23/2012 6:42 PM

Вам также может понравиться