You are on page 1of 68

Introduction to Oracle Data Integrator

&
Combining Oracle Data Integrator and
Oracle GoldenGate
Lab Guides

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

TABLE OF CONTENTS
Hands on Lab - Introduction to Oracle Data Integrator EE ................................................ 3
Overview ..................................................................................................................................................... 4
Time to Complete ...................................................................................................................................... 4
Prerequisites .............................................................................................................................................. 4
Architecture Overview .............................................................................................................................. 5
Sources: ..................................................................................................................................................... 5
Target:......................................................................................................................................................... 5
Part 0: Preparation Steps .......................................................................................................................... 6
Part 1: Review Topology Setup ................................................................................................................ 7
Part 2: Extracting, Loading and Transforming Product Data to Oracle ............................................. 11
Dimension Tables .................................................................................................................................. 11
High Level Architecture .......................................................................................................................... 11
Part 3: Extracting, Loading and Transforming Sales Data to Oracle Dimension Tables ................. 29
Optional Part 4: Extracting, Loading and Transforming Promotion Data to Oracle Dimension Tables
................................................................................................................................................................... 38
High Level Architecture .......................................................................................................................... 38
Optional Part 5: Creating a New ODI Package to Execute the Full Dimension and Sales Table Build.
................................................................................................................................................................... 46
Summary .................................................................................................................................................. 50

Hands on Lab: Combining Oracle Data Integrator and Oracle GoldenGate ......... 51
Overview ................................................................................................................................................... 52
Part 0: Preparation Steps ........................................................................................................................ 53
Part 1: Enable Staging Model for CDC .................................................................................................. 54
Part 2: Configure Oracle GoldenGate Using Generated Files ............................................................ 60
Part 3: Initialize Load to Staging and Target Tables ............................................................................ 61
Part 4: Initialize CDC Process and Perform Change Operations........................................................ 65
Summary .................................................................................................................................................. 68

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

HANDS ON LAB - INTRODUCTION TO ORACLE


DATA INTEGRATOR EE
Abstract: This lab will highlight to Developers, DBAs and Architects some of the best practices for
implementing E- LT techniques to improve performance and reduce data integration costs using Oracle
Data Integrator Enterprise Edition (ODI-EE). In this lab, participants will walk through the steps that are
needed to load and transform various sources into a relational table target. This will also include how to
deploy and manage interfaces using ODI-EE.
Scenario: Our company is in the process of building a BI system for reporting on our customer and sales
data. The physical schema for our target star schema has been finalized and we have been assigned to
build the interfaces and packages in ODI to load this star schema.
Our supporting data is in various heterogeneous systems, located across the enterprise. Sales, customer
and country data will be imported from our Sales system located on MySQL. Our product management
system contains our product and costing data and this information will be provided as comma delimited
extracts. Our marketing system is an internet based system; we will be provided an XML extract of our
promotional data from this system.
The following lessons will walk us through various steps that are needed to create the interfaces and
packages need to load the reporting star schema.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

OVERVIEW
Time to Complete
Create interfaces and packages 50 Minutes

Prerequisites
Before you begin this tutorial, you should

Have a general understanding of RDBMS concepts.

Have a general understanding of ETL concepts.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

ARCHITECTURE OVERVIEW

Sources:
Source

Type

Sales

MySQL

Customers

MySQL

Countries

MySQL

Promotions

XML

Products

CSV

Costs

CSV

Target:
Source

Type

Sales

Oracle 11g

Customers

Oracle 11g

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

PART 0: PREPARATION STEPS


In these steps you will clean and setup the environment for this exercise
1. If you have used ODI on this environment previously, you need to reset the repositories to the
original state. If this is a new environment such as a fresh installed VM, you can skip this step.
Warning: If you have custom ODI projects in the repository on this machine, they will be
deleted.

Open a terminal and enter reset_odi . Press Enter.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

PART 1: REVIEW TOPOLOGY SETUP


1. The connectivity information has already been setup for this hand on lab. This information is
setup within the Topology Manager of ODI. The next steps will walk you through how to review
this information.
2. Open the Oracle Data Integrator Studio:
Open a terminal and execute odistudio. Press Enter.
3. Go to the Topology Navigator and press Connect to Repository

4. Select HOL Basic from the drop-down list of logins and click OK.

5. Within the Physical Architecture accordion, expand the Technologies folder

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

6. For this HOL the connectivity information has been setup. Connectivity information is setup for
File, Oracle, MySQL and XML sources and targets.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

7. Double-click on the Oracle_DW data server to review settings

8. Expand the data server and double-click on ORACLE_DW.OOW_HOL_DW physical schema to


review the settings.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

Introduction to ODI & Combining ODI with OGG

9. Review any additional items as needed.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

10

Introduction to ODI & Combining ODI with OGG

PART 2: EXTRACTING, LOADING AND


TRANSFORMING PRODUCT DATA TO ORACLE
Dimension Tables
1. 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)

High Level Architecture

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

11

Introduction to ODI & Combining ODI with OGG

2. Open the ODI Studio, choose the Designer tab; If not already logged in, click on Connect To
Repository

3. Select HOL Basic from the drop-down list of logins and click OK.

4. Open the Designer navigator menu and make sure that the Default Execution Context is set to
the Development context (not Production).

5. Open the Models accordion in the Designer navigator by clicking on the label.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

12

Introduction to ODI & Combining ODI with OGG

6. Expand the ORACLE DW TRG folder

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.
8. To reverse double-click the existing model ORACLE_DW_SALES. The model editor is opened on
the right side.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

13

Introduction to ODI & Combining ODI with OGG

9. Click the Selective Reverse-Engineering tab

10. Check the Selective Reverse-Engineering checkbox and the Objects to Reverse Engineer
checkbox. The list of tables to reverse engineer is shown.

11. Click the Reverse Engineer (

) button in the toolbar.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

14

Introduction to ODI & Combining ODI with OGG

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.
Note: The other data stores that are needed for the hands on lab have already been created.

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:

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

15

Introduction to ODI & Combining ODI with OGG

13. Expand the HOL BASIC > First Folder folder

14. Right click on Interfaces and click New Interface

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.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

16

Introduction to ODI & Combining ODI with OGG

16. Click the Mapping tab below the editor

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

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

17

Introduction to ODI & Combining ODI with OGG

19. Insert target data store by dragging the PRODUCTS table from ORACLE_DW_SALES model to
the Target Datastore panel (called <Temporary Target Datastore> before the drop).

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

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

18

Introduction to ODI & Combining ODI with OGG

Keep the Join Symbol in the Mapping selected and scroll down in the Property Inspector to the
Staging Area and Join properties (see image below).
Info: The Property Inspector shows additional properties of the item currently selected in the
mapping or the target. This could be a source or target data store, row, join, filter, or lookup.
Scroll the property inspector down to find additional properties .
Set the Join to a Left Outer Join by clicking the checkbox connected to PRO (PRODUCTS) 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.

22. The Integration Knowledge Module (IKM) for 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 target
mapping for PROD_ID and click the Key check box in the property inspector below.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

19

Introduction to ODI & Combining ODI with OGG

23. We will now map the remaining target columns PROD_INSERT_DATE, PROD_UPDATE_DATE
and PROD_COST that were not mapped by auto-mapping earlier.
24. ODI allows for a special feature that will incrementally update the target based on the source and
target data. We only want to insert/update the PROD_INSERT_DATE column where there is a
new record. And we want to update the PROD_UPDATE_DATE on every insert/update.
Click on the PROD_INSERT_DATE column within the target to bring up the transformation
mapping.

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.

26. To set the transformation for the PROD_UPDATE_DATE click the PROD_UPDATE_DATE
mapping
http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

20

Introduction to ODI & Combining ODI with OGG

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.

28. The PROD_COST must also be mapped to the UNIT_COST of the CURRENT_COST table. To
map this , drag the UNIT_COST field over to the PROD_COST target column.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

21

Introduction to ODI & Combining ODI with OGG

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.
30. Click the title of the PRODUCTS source and select the LKM File to SQL

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

22

Introduction to ODI & Combining ODI with OGG

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.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

23

Introduction to ODI & Combining ODI with OGG

33. Click the title Staging Area to bring up the IKM properties

Check that the IKM Oracle Incremental Update is being used.


NOTE: We will not be using FLOW_CONTROL for this lab, turn this option to false. Flow
control is used to enforce target table constraints before inserting rows. Set DELETE_ALL
to true to overwrite any prior results.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

24

Introduction to ODI & Combining ODI with OGG

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

36. The execution context is Development, and the agent is Local.


Click OK

37. Click OK on the confirmation window

38. To review execution, go to the Operator navigator.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

25

Introduction to ODI & Combining ODI with OGG

39. Expand Today and the appropriate execution. The execution might not have finished, then it will
show the icon
for an ongoing task. You can refresh the view by clicking
to refresh once or
to refresh automatically every 5 seconds.
Double click any task to review the execution.

40. Click details or execution tab for more information such as inserts or updates.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

26

Introduction to ODI & Combining ODI with OGG

41. 72 new rows should have been inserted into the Products Table.

42. Go back to the INT_LD_PRODUCTS interface editor and select the Mapping tab. You can view
the new data in the target PRODUCTS table from the designer by right clicking the target and
clicking Data...

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

27

Introduction to ODI & Combining ODI with OGG

43. Review All Rows

44. The data has now been loaded successfully for the PRODUCTS table with new costing
information from the CURRENT_COSTS.CSV table.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

28

Introduction to ODI & Combining ODI with OGG

PART 3: EXTRACTING, LOADING AND


TRANSFORMING SALES DATA TO ORACLE
DIMENSION TABLES
1. For this interface we will be de-normalizing the SALES table by including not only the dimension
IDs but also the dimension base members for faster reporting. This will allow our BI application to
query one table for detailed reports.
Our source table SALES is on MySQL, it will be joined to the CUSTOMER table which is also on
MySQL to lookup the Customer Name. We will also join SALES to the PRODUCTS and to the
PROMOTION table which have already been loaded to our Oracle target.

High Level Architecture

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

29

Introduction to ODI & Combining ODI with OGG

2. Open the ODI Studio. To create a new interface, open the Designer navigator and Project
accordion on the HOL_BASIC / First Folder:

3. Right click and select New Interface

4. Name the interface INT_LD_SALES

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

30

Introduction to ODI & Combining ODI with OGG

5. Click the Mapping tab and drag and drop the sources SALES and CUSTOMERS from MYSQL
SRC / MYSQL_SALES model onto the sources panel:

6. A join will automatically be created for the SALES and CUSTOMER Tables. Click the join to view
the join properties.

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.
http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

31

Introduction to ODI & Combining ODI with OGG

7. Drag the PRODUCTS and PROMOTIONS


/ORACLE_DW_SALES into the source panel.

tables

from

ORACLE

DW

8. Drag the table SALES from the ORACLE_DW_SALES model to the Target Datastore area.

9. Click Yes to allow for auto mapping

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

32

TRG

Introduction to ODI & Combining ODI with OGG

10. Join PRODUCT by dragging from PROD_ID to the SALES table PROD_ID column, make sure the
Execute On location in the property inspector is changed to Staging Area.

1. Join the PROMOTIONS data by joining PROMO_ID to the PROMO_ID of the SALES table; make
sure the Execute On location in the property inspector is changed to Staging Area.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

33

Introduction to ODI & Combining ODI with OGG

2. Map PRODUCT to PROD_NAME from the joined PRODUCT table.

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

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

34

Introduction to ODI & Combining ODI with OGG

4. Map the target field PROMOTION to PROMO_NAME from the joined PROMOTIONS table.

5. The design and mappings are now complete. Click on the Flow tab.

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.

6. The KMs will be selected by default for the source and target.
Source LKM: LKM SQL to Oracle

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

35

Introduction to ODI & Combining ODI with OGG

Target IKM: IKM Oracle Incremental Update

7. Select the title of the Staging Area. Set the FLOW_CONTROL Option to false. Set DELETE_ALL
to true to overwrite any prior results.

8. The interface has now been setup to extract, de-normalize and load the SALES table from MySQL
to Oracle, using lookup tables on MySQL and on Oracle. To execute the interface click the
Execute (

) button in the toolbar.

9. When prompted to save click Yes

10. The execution context is Development, and the agent is Local.


Click OK

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

36

Introduction to ODI & Combining ODI with OGG

11. Click OK on the confirmation window

12. To review execution, go to the Operator navigator.

13. 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. The Record Statistics should display 183,941 inserts.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

37

Introduction to ODI & Combining ODI with OGG

OPTIONAL PART 4: EXTRACTING, LOADING


AND TRANSFORMING PROMOTION DATA TO
ORACLE DIMENSION TABLES
1. This interface will load the Promotion data from an XML file to the Oracle star schema
PROMOTIONS table.

High Level Architecture

2. Start the ODI Studio if not already started and open the HOL_BASIC login
3. For this interface the source PROMOTIONS.xml file will be used. ODI has a built in JDBC driver
for XML, that will be used to extract the data.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

38

Introduction to ODI & Combining ODI with OGG

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:

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

39

Introduction to ODI & Combining ODI with OGG

5. Right click and select New Interface

6. Name the interface INT_LD_PROMOTIONS

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

40

Introduction to ODI & Combining ODI with OGG

7. Click on the Mapping tab


Open to the Models accordion on the left navigator and drag PROMODATA into the source panel
of diagram tab.

8. Drag the PROMOTIONS data store from the ORACLE_DW_SALES model to the Target
Datastore panel

9. Click YES to auto mapping confirmation

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

41

Introduction to ODI & Combining ODI with OGG

10. Again for the logic of the incremental update a key must be set on the target table. To set the
PROMO_ID as the key select the mapping and check the Key check box below.

11. The source data might contain records with a NULL begin data. We need to set a filter to ignore
these records.
From the PROMODATA source field drag the PROMO_BEGIN_DATE field onto an empty area of
the diagram background.

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.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

42

Introduction to ODI & Combining ODI with OGG

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.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

43

Introduction to ODI & Combining ODI with OGG

15. Select the Staging Area to review the IKM setting. By default the IKM Oracle Incremental Update
has been set.
16. Note: Make sure to set the IKM option for FLOW_CONTROL to false. Set DELETE_ALL to true
to overwrite any prior results.

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

18. When prompted to save click Yes

19. The execution context is Development, and the agent is Local.


Click OK

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

44

Introduction to ODI & Combining ODI with OGG

20. Click OK on the confirmation window

21. To review execution go to the Operator navigator.

22. Review the execution of the steps for more information double click a step, and view the details or
execution tab. The total number of inserts for this session is 503 inserts to the target.

23. You have now successfully loaded the Promotions XML file to the PROMOTIONS Table on the
Oracle DW Sale star schema.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

45

Introduction to ODI & Combining ODI with OGG

OPTIONAL PART 5: CREATING A NEW ODI


PACKAGE TO EXECUTE THE FULL DIMENSION
AND SALES TABLE BUILD.
1. Now that the interfaces have been created we can create a package within ODI that will execute all of
the interfaces in order.
2. To create a new package, open the Designer navigator and Project accordion on the HOL_BASIC /
First Folder:

3. Right click Packages and select New Package.

Info: A package is a task flow to orchestrate execution of multiple interfaces and define additional logic, such
as conditional execution and actions such as sending emails, calling web services, uploads/downloads, file
manipulation, event handling, and others.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

46

Introduction to ODI & Combining ODI with OGG

4. Name the package PKG_LD_ALL

5. Click the Diagram tab


Drag and Drop the interfaces from the left onto the diagram panel, starting with the interface
INT_LD_PRODUCTS

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

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

47

Introduction to ODI & Combining ODI with OGG

7. Click the OK arrow toolbar button to select the order of precedence.

8. Drag and drop from the INT_LD_PRODUCTS to the INT_LD_PROMOTIONS to set the link. Then
drag and drop from INT_LD_PROMOTIONS to INT_LD_SALES.

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

11. The execution context is Development, and the agent is Local.


Click OK

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

48

Introduction to ODI & Combining ODI with OGG

12. Click OK on the confirmation window

13. To review execution, go to the Operator navigator and open the latest session execution.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

49

Introduction to ODI & Combining ODI with OGG

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.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

50

Introduction to ODI & Combining ODI with OGG

HANDS ON LAB: COMBINING ORACLE DATA


INTEGRATOR AND ORACLE GOLDENGATE
Supported Version: Oracle Data Integrator 11.1.1.6, Oracle GoldenGate 11gR2
Objectives:
Data integration is more than simply about ETL (extract, transform, load); its also about unifying
information for improved business agility. This hands-on labfor developers, DBAs, and architects
highlights best practices using Oracle Data Integrator (ODI) and Oracle GoldenGate (OGG) together to
perform real-time ETL. In the lab, participants will use ODIs Journalizing Knowledge Module for OGG to
generate OGG scripts based on ODI models and interfaces.
Prerequisite:
Basic knowledge of Oracle Data Integrator and GoldenGate, Installed Oracle Data Integrator, Oracle
GoldenGate and Oracle Database 11g instance.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

51

Introduction to ODI & Combining ODI with OGG

OVERVIEW
In this lab we are going to add OGG CDC to an existing ODI project. The project is mostly identical to the
ODI Extended Hands-on Lab that covers ODI CDC mechanisms.
For simplicity the entire setup is on one machine using a single database. Real-live use cases would most
likely use source and target on different servers, but the fundamental setup of OGG and ODI are very
similar.
The demo machine has two separate installations of OGG, one in C:\gg_src and one in C:\gg_stg. These
two locations simulate OGG installations on two separate machines.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

52

Introduction to ODI & Combining ODI with OGG

PART 0: PREPARATION STEPS


In these steps you will clean and setup the environment for this exercise
1. Reset the environment if it has been previously used.
Warning: If you have custom ODI projects in the repository on this machine, they will be deleted

Open a terminal and execute reset_odi. Press Enter.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

53

Introduction to ODI & Combining ODI with OGG

PART 1: ENABLE STAGING MODEL FOR CDC


In this exercise you will review the existing models and projects in ODI
1. Open the Oracle Data Integrator Studio:
Open a terminal and execute odistudio. Press Enter
2. Choose the Designer tab and click on Connect To Repository

3. In the Login dialog, choose HOL GoldenGate from the Login Name list.

4. Go to the Designer navigator and click on the Models title to expand the models pane.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

54

Introduction to ODI & Combining ODI with OGG

5. Review the models present in the respository: Expand each one of the 4 models
Oracle_Source, Oracle_Staging, Oracle_Target, and Flat File Sources. The Oracle_Source
model contains the tables in the original source location. Oracle_Staging contains copies of
tables from the source that need to be replicated by Oracle GoldenGate in real-time. The
Oracle_Taget model contains transformed tables in the final target location. The Flat File
Sources model contains flat file datastores that will participate in the transformation to the target
table.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

55

Introduction to ODI & Combining ODI with OGG

6. Enable the staging model for ODI CDC: The JKM for Oracle GoldenGate performs a 2-stage
CDC; OGG detects changes in the source and replicates them to the staging tables; ODI is
informed of changes arriving in the staging table through its standard CDC framework; therefore
the staging tables are enabled for CDC and generate OGG scripts to perform replication from
source to staging.
Right-click on the model Oracle_Staging, go into the submenu Changed Data Capture, and
select Add to CDC. Click Yes when asked Are you sure you want to add all the models
tables to CDC?

7. Double-click on the model Oracle_Staging to open the model editor

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

56

Introduction to ODI & Combining ODI with OGG

8. Go to the Journalizing tab.

9. In Journalizing Mode pick Consistent Set, click Ok in the Alert dialog, and in Journalizing KM
pick JKM Oracle to Oracle Consistent (OGG).

10. Enter the following options (highlighted in red) to the JKM. Leave options starting with <Default>
unchanged.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

57

Introduction to ODI & Combining ODI with OGG

Values:

LOCAL_TEMP_DIR

/tmp

SRC_LSCHEMA

ORCL_SOURCE

SRC_DB_USER

system

SRC_DB_PASSW ORD

oracle

SRC_OGG_PATH

/app/goldengate/source

STG_MANAGER_PORT

7810

STG_OGG_PATH

/app/goldengate/target

COMPATIBLE

10

11. Click Save (

) to save the model; close the model editor.

12. Right-click on model Oracle_Staging, go into the submenu Changed Data Capture
Subscriber, and select Subscribe.

13. Enter ODI as the name of a new subscriber and click the blue Arrow Down button
the list.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

58

to add to

Introduction to ODI & Combining ODI with OGG

14. Click OK to close the dialog. Click Ok on the Execution and then Information dialogs that
appear.
15. Right-click on Oracle_Staging, go into the submenu Changed Data Capture, and select Start
Journal. Click Ok on the Execution and then Information dialogs that appear.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

59

Introduction to ODI & Combining ODI with OGG

PART 2: CONFIGURE ORACLE GOLDENGATE


USING GENERATED FILES
In this exercise you will review the existing models and projects in ODI
1. Start a Terminal window by opening the menu Applications Accessories Terminal.
2. Enter cd /tmp/ODIS_to_ODIT1
Press Enter and then enter ls
Press Enter into the terminal prompt. You can see two directories containing the configuration
files for the source and staging OGG installations, as well as a Readme.txt file explaining the
configuration of OGG using these files.
3. Enter vi Readme.txt
Press Enter to review the 6 configuration steps.
4. Enter copy_gg_files
Press Enter to perform the 6 steps described in Readme.txt

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

60

Introduction to ODI & Combining ODI with OGG

PART 3: INITIALIZE LOAD TO STAGING AND


TARGET TABLES
In this exercise you will initalize both staging and target areas with the pre-existing source data.
1. Review the data in source, staging, and target table:
2. Open a Terminal and enter startGGDemo
Press Enter.
This client is a custom Java program to display changes in the 3 tables as they occur. At this point only
the source table has data. Keep this client running for later.

3. Open the ODI Studio and go to Designer > Projects.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

61

Introduction to ODI & Combining ODI with OGG

4. Review folders: The relevant folders for this GG_HOL project are:
1. Initial Load Staging: Performs a 1-to-1 copy from the source tables to the staging tables.
2. Initial Load Target: Does an bulk load & transformation from staging to target tables
3. Synchronize Target: Performs a CDC-triggered load & transformation from staging to target.
5. Expand the folder 1. Initial Load Staging and its Interfaces subfolder:

6. Right click on interface Initial Load Staging and select Execute. Click Ok on the Execution and
then Information dialogs that appear.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

62

Introduction to ODI & Combining ODI with OGG

7. Open the ETL Demo Client to review the loading of the staging data:

8. Expand the folder 2. Initial Load Target and its Interfaces subfolder:

9. Right click on interface Full Load Customer to Target and select Execute. Click Ok on the
Execution and then Information dialogs that appear.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

63

Introduction to ODI & Combining ODI with OGG

10. Open the ETL Demo Client to review the loading of the target data:

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

64

Introduction to ODI & Combining ODI with OGG

PART 4: INITIALIZE CDC PROCESS AND


PERFORM CHANGE OPERATIONS
1. Open the ODI Studio and go to Designer Projects.
2. Expand the folder 3. Synchronize Target and its Packages folder.

3. Double-Click on the Sync Target package to open it. Click on the Diagram tab.
The interface consists of a perpetual loop that is triggered by a new journal log entry and
processes new changes with the CDC Load Customer interface.

4. Click the Execute button (

) in the toolbar to start the interface.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

65

Introduction to ODI & Combining ODI with OGG

5. Open the Operator from the toolbar to review the process of the Sync Target interface.

6. Open the DateTodaySync Target tree branch in the operator. The interface is currently
running and waiting for a new journal entry at OdiWaitForLogData 1.

7. Open the ETL Demo Client and double-click on a FIRST_NAME of an entry in the Source table.
The entry is editable.

8. Edit the name to something else and press Enter. Watch the Staging and Target tables. After a
few seconds the FIRST_NAME in the Staging table flashes yellow and after that the
concatenated CUST_NAME in the Target table.

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

66

Introduction to ODI & Combining ODI with OGG

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

67

Introduction to ODI & Combining ODI with OGG

SUMMARY
At the end of these exercises the participants understand how to:

Configure the ODI JKM for Oracle-to-Oracle with OGG

Use the generated OGG configuration to set up a CDC process

Operate and diagnose the CDC process with OGG and ODI

Questions & Clarifications:


If you have any comments or need additional information, please communicate through the Oracle Data
Integrator forum at: http://forums.oracle.com/forums/forum.jspa?forumID=374

http://www.oracle-developer-days.com
Copyright 2012, Oracle and/or its affiliates. All rights reserved

68

You might also like