Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Page 1 of 47
Page 2 of 47
Overview
Time to Complete
Create interfaces and packages 50 Minutes
Prerequisites
Before you begin this tutorial, you should
Architecture Overview
Sources:
Source
Sales
Customers
Countries
Promotions
Products
Costs
Type
SQL Server
SQL Server
SQL Server
XML
CSV
CSV
Target:
Source
Sales
Customers
Last Updated: 31-Aug-10
Type
Oracle 10g
Oracle 10g
Page 3 of 47
Oracle 10g
Oracle 10g
Oracle 10g
Oracle 10g
3. Open the Oracle Data Integrator Studio using the Start Menu > Oracle >
Oracle Data Integrator > ODI Studio menu.
4. Go to the Topology Navigator and press Connect to Repository
5. Select HOL Basic from the drop-down list of logins and press OK.
Page 4 of 47
Page 5 of 47
Page 6 of 47
Page 7 of 47
Page 8 of 47
1. Select HOL Basic from the drop-down list of logins and press OK.
4. Open the Designer navigator menu and make sure that the Default Execution
Context is set to the Development context (not Production).
Page 9 of 47
7. The target Oracle star schema has been physically created within the RDBMS.
But the logical data stores to represent the physical model have not been
created within ODI. The logical data stores can be created by reverse
engineering the Oracle ORACLE_DW_SALES.
Info: A model is a set of metadata definitions regarding a source such as a database
schema or a set of files. A model can contain multiple data stores, which follow the
relational concept of columns and rows and can be database tables, structured files,
or XML elements within an XML document .
Page 10 of 47
The reversed tables will show up in the model tree and are now logical data
stores within ODI that can be used as a source or target within an ODI
Interface.
Last Updated: 31-Aug-10
Page 11 of 47
12. The first interface to be created will load the products data (PRODUCTS.CSV)
into the Oracle star schema. The products data will be joined with the
current cost data (CURRENT_COSTS.csv) file so the product cost (UNIT_COST)
can be stored in the PRODUCTS dimension table (PROD_COST)
To create a new interface, open the Project accordion within the Designer
navigator:
Page 12 of 47
Info: An interface is a data flow to move and transform data from multiple sources
into one target. It contains declarative and graphical rules about data joining and
transformation.
15. In the Interface editor name the interface INT_LD_PRODUCTS
Note: The staging area does not need to be changed since we will use the
target as the staging area.
Page 13 of 47
17. For this interface we will load the PRODUCTS.csv file and
CURRENT_COSTS.csv from model FlatFileSrc to PRODUCTS table within the
model ORACLE_DW_SALES.
To view the models open the Models accordion
18. Open the FLAT FILE SRC folder and FlatFileSRC model and drag the
CURRENT_COSTS and PRODUCTS source csv files into the source panel of the
designer
Page 14 of 47
20. Click Yes on the confirmation for auto mapping. ODI will perform some
mapping for you.
21. Join the csv files by click the appropriate column in each table and dragging
to one another. The tables are joined by PROD_ID and PROD_ID
22. Set the Join to an Left Outer Join so no rows are lost when loading to the
PRODUCTS table. Also change where the join will be executed by selecting
Staging Area. Since we are using a data type that does not accept joins we
must do this join in the staging area. Both tables will be loaded to the target
and then joined.
Page 15 of 47
23. The IKM Incremental update needs a primary key set to be able to
differentiate between updated and new records. To set the primary key, click
on the mapping for PROD_ID and click the Key check box in the mapping
below.
Page 16 of 47
25. Within the Implementation area enter SYSDATE, you can do this directly in
the text box or open the expression editor. Also make sure to choose Target
for the mapping, and uncheck the Update checkbox. Un-checking the update
turn off updates for this column when this row is updated based on the
primary key.
Page 17 of 47
27. Within the mapping area enter SYSDATE, you can do this directly in the text
box or open the expression editor. Also make sure to choose Target for the
mapping, Insert and Update are checked by default. Make sure both are
checked to ensure the column is updated for both inserts and updates.
Page 18 of 47
29. The transformations have now been setup. To set the IKM click on the Flow
tab of the editor.
Note: The KMs that will be used have already been imported into the project.
Info: A knowledge module (KM) is a template that represents best practices to
perform an action in an interface, such as loading from/to a certain technology (Load
knowledge module or LKM), integrating data into the target (Integration Knowledge
Module or IKM), checking data constraints (Check Knowledge Module or CKM), and
others. Knowledge modules can be customized by the user.
ODI will select default KMs. For the small PRODUCT.CSV file the LKM File to
SQL should be used. For the larger CURRENT_COSTS.CSV file the LKM File to
Oracle (SQLLDR) should be used.
To set the LKM for each source, click the title of the source; this will open the
KM properties.
Page 19 of 47
31. Click the title of the CURRENT_COSTS source and select the LKM File to
Oracle(SQLLDR)
No coding is needed by the user. ODI will create all needed scripts.
32. In the Options for LKM File to Oracle (SQLLDR), set
DELETE_TEMPORARY_OBJECTS to false.
Page 20 of 47
33. Click the title Staging Area to bring up the IKM properties
Page 21 of 47
34. The interface has now been setup to join the Products and Costs file and load
into the Products table. To execute the interface click the Execute ( )
button in the toolbar.
35. When prompted to save click Yes
Page 22 of 47
40. Click details or execution tab for more information such as inserts or updates.
Page 23 of 47
41. 72 new rows should have been inserted into the Products Table.
42. Go back to the INT_LD_PRODUCTS interface editor. You can view the new
data in the PRODUCTS table from the designer by right clicking the target and
clicking Data...
Page 24 of 47
44. The data has now been loaded successfully for the PRODUCTS table with
new costing information from the CURRENT_COSTS.CSV table.
Page 25 of 47
2. Start the ODI Studio if not already started and open the HOL_BASIC login
3. To create a new interface, open the Designer navigator and Project accordion
on the HOL_BASIC / First Folder:
Page 26 of 47
6. Click the Mapping tab and drag and drop the sources SALES and CUSTOMERS
from SQL SERVER SRC / SQL_SERVER_SALES model onto the sources panel:
7. A join will automatically be created for the SALES and CUSTOMER Tables.
Click the join to view the join properties.
Page 27 of 47
Make sure the join is set to Source. This will allow the integration to take
advantage of the exiting indexes on the source. Doing this type of join in
conventional ETL tools would require custom SQL expressions.
8. Drag the PRODUCTS and PROMOTIONS tables from ORACLE DW TRG /
ORACLE_DW_SALES into the source panel.
9. Drag the table SALES from the ORACLE_DW_SALES model to the Target
Datastore area.
Page 28 of 47
12. Join the PROMOTIONS data by joining PROMO_ID to the PROMO_ID of the
SALES table, make sure the join is on the Staging Area.
Page 29 of 47
14. Map the target field CUSTOMER by concatenating the first and last name of
the customer using a mapping on the Staging Area of
CUSTOMERS.CUST_FIRST_NAME || ' ' || CUSTOMERS.CUST_LAST_NAME
Page 30 of 47
15. Map the target field PROMOTION to PROMO_NAME from the joined
PROMOTIONS table.
16. The design and mappings are now complete. Click on the Flow tab.
Page 31 of 47
The power of ELT and ODI is apparent by how easy it is to set certain
transformation on the source, target or staging area. ODI will generate the
flow automatically, we have only defined what we want to do, not how it will
be done.
17. The KMs will be selected by default for the source and target.
Source LKM: LKM SQL to Oracle
Target IKM: IKM Oracle Incremental Update
18. Select the title of the Staging Area. Set the FLOW_CONTROL Option to false.
Set DELETE_ALL to true to overwrite any prior results.
Page 32 of 47
Page 33 of 47
24. Double click any step for details, click the details, or execution tab for more
information. The execution of the interface might take up to a few minutes to
complete, during which time the completed steps will be shown.
Page 34 of 47
2. Start the ODI Studio if not already started and open the HOL_BASIC login
Page 35 of 47
Info: ODI works with XML data by using a specialized JDBC driver that will map an
XML schema into multiple tables. Each non-leaf element is represented by a table,
hierarchy is reflected through PK-FK relationships. Using XML sources in interfaces is
the same as using a relational DB source.
4. To create a new interface, open the Designer navigator and Project accordion
on the HOL_BASIC / First Folder:
Page 36 of 47
Page 37 of 47
Page 38 of 47
12. Select the filter and edit the Implementation property of the filter. Complete
the expression to read: PROMODATA.PROMO_BEGIN_DATE is not null
13. The date columns in the XML file are setup as varchar fields. We can
implicitly convert these within the staging area by select the Staging Area for
the mapping of the two date fields PROMO_BEGIN_DATE and
PROMO_END_DATE.
Page 39 of 47
14. Click the Flow tab to review the Flow and KM settings
Note: By default the LKM SQL to Oracle KM should have been selected for
the XML Source.
If not, select this LKM. Even though this is an XML file, the JDBC driver allows
ODI to interact with the file as though it is a relational table.
Page 40 of 47
45. The interface has now been setup to load the Promotions XML file to the
PROMOTIONS table. To execute the interface click the Execute ( ) button
in the toolbar.
46. When prompted to save click Yes
Page 41 of 47
16. Review the execution of the steps for more information double click a step,
and view the details or execution tab
Page 42 of 47
17. You have now successfully loaded the Promotions XML file to the
PROMOTIONS Table on the Oracle DW Sale star schema.
Page 43 of 47
Page 44 of 47
Notice the green arrow on this interface which means it is the first step.
6. Drag the interfaces INT_LD_PROMOTIONS and INT_LD_SALES onto the panel
9. The package is now setup and can be executed. To execute the interface click
the Execute ( ) button in the toolbar.
10. When prompted to save click Yes
Page 45 of 47
13. To review execution go to the Operator navigator and open the latest session
execution.
Page 46 of 47
Summary
You have now successfully completed the Hands on Lab, and have successfully
loaded the Product and Promotions dimension table as well as de-normalizing and
loading the sales fact table. Once the interfaces were created to load and transform
the data, a package was created to execute all the interfaces in the correct order.
Page 47 of 47