Professional Documents
Culture Documents
D82167GC10-Practices For Lesson 8
D82167GC10-Practices For Lesson 8
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Practice Overview
In this practice, you create simple mappings, run these mappings, and verify their execution.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Use Case Scenario
John created the new ODI models and reverse-engineered all the tables and files in the models,
defined the constraints on the models, and checked data quality. Now, John begins working on
creating ODI mappings to pass data between models and perform simple data transformations.
These mappings will then be used for the development of his integration project.
Background
After the models are defined and the quality of the data is verified, you need to create an ODI
mapping to perform transformations. In this practice, you create simple mappings with one
target table and a single source. You will run these mappings and check the execution.
In this practice, you create three mappings. First, you create a mapping called MAP_8-1,
loading the TRG_COUNTRY datastore in the Oracle Sales Application model with the content of
the SRC_REGION table from the MySQL Orders Application model. This simple mapping has no
transformations.
The second mapping, MAP_8-2, is a duplicate of MAP_8-1, to which flow control is activated
and constraints in the target table are checked.
The third mapping, MAP_8-3, loads the TRG_COUNTRY datastore in the Oracle Sales
Application model with the content of the SRC_CITY table from the MySQL Orders Application
model. In this mapping, flow control is activated, constraints in the target table are checked, and
city population values are transformed from individual to times 1,000.
Note: Completing this practice is critical for other practice sessions.
Your Tasks
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
1. Reset your practice environment.
a. Disconnect from the ODI repository (or just close ODI Studio).
b. In the Terminal window, execute the following reset commands:
When prompted, verify that you disconnected from the ODI repository, and then press
Enter. Wait until this script completely executes.
[oracle@hostname ~]$ cd ~/labs
[oracle@hostname labs]$ ./reset08.sh
Note: This process may take one minute or more to complete.
c. Restart ODI Studio.
d. Connect to Repository using the same wallet password of Welcome1 as you have in
the past.
e. Log in using the same Name: DEV_ODI_REPO and User: SUPERVISOR as you have in
the past.
2. Create a mapping called MAP_8-1, loading the TRG_COUNTRY datastore in the Oracle Sales
Application model with the content of the SRC_REGION table from the MySQL Orders
Application model. Map the columns of the same name without any transformation. Ensure
that you take only distinct records.
a. In Designer, click the Projects tab, and expand the HandsOnLoads project. Expand
the HandsOn folder. Select the Mappings node, right-click, and select the New
Mapping option.
b. In the Mapping window, enter MAP_8-1 as the name of the mapping. Deselect Create
Empty Dataset. Click OK.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
c. Click the Logical tab. Arrange the panels so that you can see the Properties MAP_8-1
panel and fields. You may want to not view the thumbnails at this time.
d. In the Designer Navigator to the left, click the Models bar. In the tree view, expand the
Oracle Sales Application model. Drag the TRG_COUNTRY datastore from the tree
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
view to the right side of the modeling zone (see the previous screen: the panel with text
stating “Drag objects from the navigator here…”). The datastore model appears in this
zone.
e. Expand the MySQL Orders Application model and drag the SRC_REGION datastore
from the model tree to the left side of the modeling zone in your diagram.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
f. There may be multiple regions per country. If you mapped SRC_REGIONS directly to
TRG_COUNTRY, you would get duplicates. To prevent duplicates, drag a Distinct
component in between the two models.
g. Connect the two models through the Distinct component, source to target. Drag the
source-right port (circle) to one side of the Distinct, drag the other side of the Distinct to
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
the target-left port (circle).
h. An Attribute Matching dialog box appears each time you connect to the Distinct
component. Click OK each time. Now the system automatically maps attributes by
name in the source and target datastores.
then
The grey (filled) arrows indicate which fields auto-mapped, whereas the white (hollow)
arrows indicate which did not automap. (Later you will see yellow arrows.) You may
need to drag the bottom frame handle of the DISTINCT down to see all of the fields.
i. If you left it like this default mapping, ODI would think that each region should be
distinct, but then you would get duplicate countries. So select and delete the
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
DISTINCT.REGION_ID attribute.
j. Select TRG_COUNTRY, and in the Properties panel, change the Target > Integration
Type to Incremental Update.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
k. Click the Physical tab. After the flow diagram initializes, you may want to use the
zoom-out button to see all the objects in the diagram. There is nothing you need to do
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
here at the moment, but it is interesting to click objects to see their properties. Do not
change anything here yet.
l. Click Save to save your mapping. If the Locking Object window appears, select “Don’t
show this window next time,” and click Yes.
3. Run this mapping, and check the content of the TRG_COUNTRY table.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
a. Expand the Mappings node, right-click the newly created MAP_8-1, and select Run.
b. Click OK in the Execution window, and then click OK when the Session Started
message appears.
c. Click the Operator tab to open the ODI Operator Navigator. The Operator window
appears.
Note: You may need to click the Refresh button to view the new session.
d. In the Session List tab, expand the All Executions node. The session called MAP_8-
1 should appear complete. Expand this session in the tree view as shown:
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
The warning about Drop work table can be safely ignored.
e. In your mapping window, click the Logical tab. Right-click TRG_COUNTRY, and then
select Data.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Verify your data and close this window. Close MAP_8-1 tab. If the Unlocking Object
window appears, select the “Don’t show this window next time” check box and click
Yes.
4. Create a mapping called MAP_8-2 that loads the TRG_REGION datastore in the Oracle
Sales Application model with the content of the SRC_REGION table from the MySQL Orders
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Application model. Map the columns of the same name without any transformation. Ensure
that flow control is activated and all constraints in the target table are checked.
Note: Because this new mapping uses the same source as the previous one, you will
duplicate MAP_8-1.
a. Click the Designer tab. Expand the Projects bar, the HandsOnLoads project, and the
HandsOn folder. Expand the Mappings node and select MAP_8-1. Right-click and
select Duplicate Selection, and then click Yes in the confirmation box. A copy of your
mapping appears.
b. Double-click the mapping Copy of MAP_8-1 to edit it. Click the Overview tab. In the
Definition > Name field, change the name to MAP_8-2, and then click the Logical tab.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
c. Click Perform Layout to realign the view of the modeling zone.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
e. Confirm the Delete by clicking Yes.
f. Select and delete the connector from SRC_REGION to DISTINCT. Deselect “Preserve
downstream expressions.”
g. In the Designer tab, click the Models bar, and then drag the TRG_REGION datastore
from the Oracle Sales Application model to the modeling zone. Leave the source
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
datastore unchanged.
2) Connect the right side of DISTINCT to the left side of TRG_REGION. Click OK to
accept the default Attribute matching.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
3) It should now look like this:
The grey arrows indicate which fields auto-mapped, whereas the white arrows indicate
which did not automap.
i. Click TRG_REGION and in the Properties panel, change Target > Integration Type to
Incremental Update.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
j. Click the Physical tab, then click TRG_REGION, and change the Integration Knowledge
Module to IKM Oracle Incremental Update.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Note that in the Properties section Options list, the FLOW_CONTROL is set to True.
k. Scroll down to verify in Physical > Check Knowledge Module that the selected Check
Knowledge Module is CKM Oracle.
l. Click the Logical tab. Verify that in the Logical > Constraints section, the value for
each of the two Constraints should be “true”.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
m. Click Save to save your mapping.
5. Run this mapping, and check the contents of the TRG_REGION table.
a. Click Run.
b. Click OK in the Execution window, and then click OK when the Session Started
message appears.
Note: Do not let the name MAP_8-1_DS bother you, that is okay, it really is MAP_8-2.
If it does bother you, you could have changed it on the Physical tab.
c. In ODI Operator, verify that your new mapping executed successfully. You may need to
refresh the list by contracting and then expanding the All Executions node in the
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Session List:
d. In the Mapping window, click the Logical tab. Select the TRG_REGION target datastore
(click the name of the datastore), right-click, and select Data. A window appears with
the loaded data.
e. Verify the data, close this window, and then close your mapping MAP_8-2.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
6. Create a mapping called MAP_8-3 that loads the TRG_CITY datastore in the Oracle Sales
Application model with the contents of the SRC_CITY table from the MySQL Orders
Application model. Ensure that flow control is activated and all constraints in the target table
are checked. You need to transform the city population values because the target table unit
is “thousands of inhabitants,” whereas the source table unit is “inhabitants.”
a. If not open, click the Designer tab, and click the Projects bar. Expand HandsOnLoads
> HandsOn folder. Right-click the Mappings node and select New Mapping.
b. In the Mapping Definition tab, enter the name MAP_8-3. Click OK.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
c. Click the Logical tab. Open the Designer > Models > Oracle Sales Application
model. Drag the TRG_CITY datastore from the tree view to the model zone. The
datastore appears in this zone.
d. Expand the MySQL Orders Application model and drag the SRC_CITY datastore
from the model tree to the model zone of your diagram.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
e. Connect SRC_CITY to TRG_CITY. (Because they are the same number, names, and
types of columns, you do not need a Distinct component.)
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Note: All of the arrows are grey, none of the arrows are white, and all fields mapped
even though the column order was different.
g. Select the POPULATION column in the target TRG_CITY datastore.
h. In the POPULATION - Properties section of the Property Inspector, in the Target tab,
edit the Expression to populate the POPULATION column with the number of thousands
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
of inhabitants rounded to the nearest thousand. Edit the expression to have the
following: FLOOR(SRC_CITY.POPULATION/1000)
Note: You use the FLOOR function to perform rounding down.
i. To verify the mapping (and the transformation expression), click Validate the Mapping
. Close the Validation Results window.
j. Click the Logical tab. Click TRG_CITY. In TRG_CITY - Properties > Target >
Integration Type, select Incremental Update.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
k. Click Physical and click TRG_CITY. In the TRG_CITY - Properties, scroll down the
Integration Knowledge Module. Select IKM Oracle Incremental Update. In the
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Options list, scroll to FLOW_CONTROL, and ensure that it is set to True.
l. Click Physical and click TRG_CITY. Ensure that the selected Check Knowledge
Module is CKM Oracle.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
m. Click Logical and click TRG_CITY. In TRG_CITY - Properties > Constraints, the value
for each Constraint should be “true”. Click Save to save your mapping. Close your
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
mapping editor tab.
7. Run this mapping, and check the content of the TRG_CITY table.
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
a. In Designer > Projects, right-click mapping MAP_8-3, and then select Run.
b. Click OK in the Execution window, and then click OK when the “Session started”
message appears.
c. Open the Operator Navigator and verify that your mapping session executed
successfully:
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
Note: In Operator, you may need to click the Refresh button .
d. If you look at some of the “Drop xxxx table” warnings, they are present because the
temporary work table was not there to be dropped, because by default ODI cleaned up
after itself in the past before this particular run. There are numerous ways of dealing
with this warning, all of which are optional. These messages can be safely ignored.
e. In the Designer navigator, open the Models bar. In the Oracle Sales Application
model, right-click the TRG_CITY datastore and click View Data. A window appears
Oracle University and AUTOMATION & COMPUTER TECHNOLOGY SAL OFFSHORE use only
with the loaded data. Scroll down and view the total number of loaded records and
loaded data.
f. Verify the data, and then close the Data: TRG_CITY tab.
Note: The POPULATION column should show thousands of inhabitants.
8. Clean up the desktop by closing ODI Studio.
This completes Practice 8-1. This completes the practices for Lesson 8.