You are on page 1of 92

Purpose

This tutorial walks you through the steps that are needed to create an Oracle Data Integrator Studio (ODI) procedure and
scenario, and schedule the scenario to run at a later time.

Time to Complete
Approximately 1 hour.

Introduction
When a set of objects is complete and tested, a good practice is to create an ODI scenario for packages and sometimes
procedures. After a scenario is created, it cannot be edited, and the code for the object is regenerated and stored in the scenario.
The created scenarios can also be scheduled for running virtually on any time interval within ODI. In this OBE, you create an
ODI procedure, then schedule a scenario for the procedure at a later time.
This is the fourth in a series of four OBEs in the Oracle Data Integrator 12c: Getting Started series.

Scenario
Linda works as a database administrator for Example Enterprise Corp (http://www.example.com). In Example 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, she
created the new Master repository and Work repository. Linda also created the project and the procedure to create a relational
table and populate it with data. She set up and installed an ODI Agent as a service. Now Linda needs to create and schedule an
ODI scenario to run the procedure at the appropriate time.

Hardware and Software Requirements


The following is a list of software requirements:
o A supported operating system (the OS shown here is 64-bit Oracle Enterprise Linux release 6.7 (Santiago), other versions
such as Windows are supported as well)
o Oracle Database (the version shown here is Enterprise Edition 12.1.0.2.0, other versions are supported as well)
o Oracle Data Integrator 12c (the version shown here is 12.2.1)
The following is a list of OPTIONAL software:
o Oracle WebLogic Server (WLS) 12c (other versions are supported as well)
o Oracle SQL Developer 12c (included with Database 12c install)
If WLS is present, it must be in the same Middleware HOME directories as ODI.

Prerequisites
Before starting this tutorial, you should have:
o Started Oracle Database services and components such as the Listener.
o A Database user with DBA role privileges such as the SYS or SYSTEM account.
o Installed the HR schema included in the Oracle Database. The Sample Schemas Installation Guide is part of the Oracle
Database documentation set, and is also available online at: http://otn.oracle.com.
o Already installed and configured ODI Master and Work repositories
(instructions on how to do this are contained in the first of four OBEs in the ODI 12c Getting Started series).
o Already created an ODI project and mapping for a flat file to a relational table
(instructions on how to do this are contained in the second of four OBEs in the ODI 12c Getting Started series).
o Already created both a physical and logical agent, and still have a running ODI agent process
(instructions on how to do this are contained in the third of four OBEs in the ODI 12c Getting Started series).

1. Creating an ODI Project


An ODI project contains (among other things) ODI procedures, scenarios, and schedules.
To create a project to hold the components of this OBE, perform the following steps:

1.1 Starting ODI Studio


Start ODI Studio by running odi.sh.

OS Prompt

[myuser@myhost ~]$ cd $ODI_HOME/studio


[myuser@myhost studio]$ pwd
/u01/app/oracle/Middleware/Oracle_Home/odi/studio
[myuser@myhost studio]$ ./odi.sh

Oracle Fusion Data Integrator Studio 12c


Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.

The splash screen and progress bar displays briefly.

On the left panel, on either the Designer or Topology tab, click Connect To Repository...

Enter the Wallet Password. (It may be pre-stored.)


Click OK to continue.
Enter the SUPERVISOR Password. (It may be pre-stored.)

Click OK to continue.
A progress bar is displayed briefly.

When ODI Studio is finished connecting to the repositories, the navigation panel on the left is populated.

In summary, you have started ODI Studio.

1.2 Creating a Project


On the left, on the Designer tab, expand Projects. On the Projects pull-down (three colored squares icon), select New Project.

An unnamed Project panel opens on the right.

On the right, on the Definition tab, in Name, enter Proc-Crt-Tbl (Procedure Create Table, though you could name it anything).
Save your work by clicking .
You should now see your new Project in the tree on the left.

There may be other previous projects there as well, though this OBE does not depend on them. You can close open tabs on the right.

In summary, you created a new project to hold the objects you are about to create.

2. Creating and Running a Procedure


An ODI procedure is like a script. It may contain SQL and file operations. Using checkboxes for options, you can anticipate
many common situations.
To create and run a procedure, perform the following steps:

2.1 Configuring the Definition


On the left, on the Designer tab, expand Projects > Proc-Crt-Tbl > First Folder > Procedures. Right-click Procedures and select New Procedure.

An unnamed procedure panel opens on the right.

On the right, on the Procedure panel, on Name enter Procedure-create-populate-table . In the Target Technology pull-down,
choose Oracle.
Note that the Source Technology does not apply in this example.

In summary, an empty Procedure has been created, that is, a procedure defintiion with no tasks yet.

2.2 Task Drop Table


On the Tasks tab, click Add (the green plus).

It creates a blue line on the top, but the blue line gets populated by your entering information on the bottom Properties panel, you don't enter anything on the blue
line itself.

In the Properties panel below, in the General section, in Name enter Drop Table . Select Ignore Errors to cover the situation where you try to drop a non-
existent table.
In the Target Command section, select the following pull-downs:
Technology = Oracle
Context = Global
Schema = DB-HR

In Command, enter DROP TABLE hr.planets in the big box. Notice there is no punctuation after the table name, no semi-colon, nothing.
Note the blue line getting completed above as you work below. It might not be a bad idea to save things at this point, but you do not have to.

In summary, you entered a single SQL command to drop a table. If the table does not exist, the task just ignores the error. At
some later time you can decide whether it is wiser to DROP versus TRUNCATE a table.

2.3 Task Create Table


On the Tasks tab, click Add (the green plus) a second time. It creates a second blue line on the top. Later you can change the order of the lines up or down.

In the Properties panel below, in the General section, in Name enter Create Table .
In the Target Command section, select the following pull-downs:
Technology = Oracle
Context = Global
Schema = DB-HR
In Command, rather than trying to type something bigger than the box, click on the gear to the right of the box.
The gear opens an Edit Expression pop-up dialog box.
You can type the SQL expression by hand, or use the functions to build the expression. Or you can cut-n-paste from here.
Notice again that there is no punctuation at the end of a single SQL statement. Click OK to continue.

In summary, you created a task step with a single SQL statement to create the empty table and associated primary key index.

2.4 Task Populate Table


Now you need to populate the new table with data. On the Tasks tab, click Add (the green plus) a third time. It creates a third blue line on the top. Later you
can change the order of the lines up or down.

In the Properties panel below, in the General section, in Name enter Populate Table .
In the Target Command section, select the following pull-downs (same as the previous step):
Technology = Oracle
Context = Global
Schema = DB-HR
In Command, rather than trying to type something much bigger than the box, click on the gear to the right of the box.
Notice that these DML statements are by default Transaction = Autocommit, so there is no need to have your own commit; in the block of instructions for this
step. The gear opens an Edit Expression pop-up dialog box.
You can type the SQL expressions by hand, or use the functions to build the expressions. Or you can cut-n-paste from here.
The punctuation for this multi-line set of SQL statements is different than the first two single line statements. The begin keyword has no punctuation, but each of
the INSERT lines does end in a semi-colon; and the final block end statement also terminates with a semi-colon. Click OK to close the Edit Expression panel
and continue.

Save your work by clicking .

In summary, multi-line sets of SQL statements are punctuated differently than single SQL statements, and must be enclosed
in a begin/end; block. You created a step to populate the new table.

2.5 Running Procedures


You may or may not be locking and unlocking the objects as you edit them. In a standalone (single-user) environment, it does not matter what you do with locking.
In a multi-user environment, it might be safer to lock objects to prevent others from editing them at the same time as you are editing.

If you see this message, click Yes to continue.

On the left, on the Designer tab, expand Projects > Proc-Crt-Tbl > First Folder > Procedures. Right-click Procedure-create-populate-table and select Run.
There are other ways to get a procedure to run as well.
On the Run dialog box, accept the defaults.

Click OK to continue.
On the Information dialog box, there is nothing you need to do.
Click OK to continue.

On the left, on the Operator tab, expand Date > Today > Procedure-create-populate-table-datetime > Procedure-create-populate-table-datetime and look

for the green circle check marks .

If they are all green, then the procedure completed successfully. Note that the first time you run this procedure, the DROP TABLE technically did not complete,
but with Ignore Errors selected, that task shows up as a green check mark.
Verify that the table was actually populated using a tool outisde of ODI. Use either SQL*Plus, SQL Developer, TOAD, or equivalent to query
the PLANETS table.

SQL Prompt

[myuser@myhost ~]$ sqlplus hr/hr

SQL*Plus: Release 12.1.0.2.0 Production on Mon Jul 29 13:27:03 2015


Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Fri Jul 26 2015 15:02:23 -04:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT * FROM hr.planets;


SUN_ORDER NAME DIAM_KM
---------- ------------ -----------
1 Mercury 4878
2 Venus 12104
3 Earth 12742
4 Mars 6779
5 Jupiter 139822
6 Saturn 116464
7 Uranus 50724
8 Neptune 49244
9 Pluto 2390

9 rows selected.

SQL>

If you see nine planets (hey, I remember the Good Ole Days when Pluto was a planet...) then your procedure worked.

In summary, the procedure was started manually and ran successfully.

3. Using Scenarios
Scenarios can be generated from several ODI objects including Packages, Mappings and Procedures. Generating a scenario for
an object compiles the code for this object for deployment and execution in a production environment. Being compiled,
scenarios cannot be modified.
To create a scenario from a procedure, perform the following steps:

3.1 Generating a Scenario


On the left, on the Designer tab, expand Projects > Proc-Crt-Tbl > First Folder > Procedures. Right-click Procedure-create-populate-table and
select Generate Scenario.
On the New Scenario dialog box, accept the defaults. Notice the dashes in the name turned into underscores.

If you were to compile it again, it would be Version 002, then 003, and so on. Click OK to continue.

On the left, expand Scenarios, and you should see the new one you just added: PROCEDURE_CREATE_POPULATE_TABLE Version 001.
You could optionally run the scenario at this time, but it won't look any different than running the uncompiled procedure again.

In summary, making a scenario is all of one step. Now it exists in a compiled form that can be run manually ad hoc, or
scheduled to run later.

4. Scheduling a Scenario
Procedures cannot be scheduled, only scenarios (compiled procedures) can be scheduled. Scheduling requires an agent.
To schedule a scenario to run at a later date/time, perform the following steps:

4.1 Testing the Agent


You created an agent in an earlier OBE. To make sure that the agent is still working, do this:
On the left, on the Topology tab, expand Physical Architecture > Agents. Right-click OracleDIAgent1 and select Test.
There are other ways to get to the test.
An ODI Information dialog box pops up and says that the test was successful.
If the test was not successful, revisit the previous OBE on Creating an Agent.

Click OK to continue.

In summary, you have a working agent that can be used to schedule a scenario.

4.2 Scheduling the Scenario


Suppose you want the scenario to run at 4am tomorrow, one time.
On the left, on the Designer tab, expand Projects > Proc-Crt-Tbl > First Folder > Procedures > Procedure-create-populate-table > Scenarios >
PROCEDURE_CREATE_POPULATE_TABLE Version 001 > Scheduling. Right-click Scheduling and select New Scheduling.
Had you not finished the previous OBE, you may get a reminder message similar to the one below. If you did complete the previous OBE, then you should not see
that message.

If you do have this message, click OK, then go back and redo the previous OBE on Creating an Agent.
On the right, on the Scheduling panel, on the Definition tab, in the Logical Agent pull-down, select MyAgent.
In the Execution section, you can either set the date/time manually, or click the calendar icon.
On the Time and Date Selection dialog box, click on the calendar one-time date you want (for example, August 2nd), then click-and-hold the minute hand of the
clock and drag it around to the desired time (for example, 4am).

Click OK to continue. Save your work by clicking .


You should see the new GLOBAL/MyAgent on the left under the expanded Scheduling.

On the left, on the Topology tab, expand Physical Architecture > Agents. Right-click OracleDIAgent1 and select either Update Schedule or Open.

If you selected Open, then the next panel displays. Click Update Schedule to continue.
On the Select Repositories dialog box, you only have one repository to choose from.

Click OK to continue. The Information dialog box pops up when the update is completed.
Click OK to continue.
You can optionally view the schedules for a given agent. Click View Schedule to see the timeline. Scroll left/right if you cannot see the whole image.

Since the duration is so very short, the line is hardly visible. Looking at 4:00am (the upper red arrow), in the middle of the dotted line is a solid line (the lower red
arrow). That represents the scenario on the timeline. Click OK to continue.

In summary, you have scheduled the scenario to run at 4 in the morning. Now we wait for that time to pass!

4.3 Testing the Scenario


Sometime after the scheduled time, check the status of the run. You can look in several places. For the first place to look, on the left, on the Operator tab, expand

Session List > Date > Today > PROCEDURE_CREATE_POPULATE_TABLE-scheduled_time and look for the green circle check marks at the
appropriate runtime.
Alternatively, for the second place you could have looked under
Session List > Agent > OracleDIAgent1 > PROCEDURE_CREATE_POPULATE_TABLE-scheduled_time and look for the green circle check

marks at the appropriate runtime. These two entries are the the same event: one event displayed in two places.

In summary, you created a schedule and then used the Operator tab to check the status of the run after the run completed.
Starting ODI 12.2.1
1. Double-click the ODI 12c Studio desktop icon.

Description of this image

2. In ODI, click Connect to Repository in the left navigation pane.

Description of this image

3. In the Oracle Data Integrator Login dialog box, enter the following values and then click OK:
o Login Name: Cubes and Dimensions
o User: SUPERVISOR
o Password: welcome1

Description of this image

The user and password is prepopulated from the wallet. If you're asked for the wallet password, enter welcome1.
ODI is now started and ready to create cubes and dimensions.

Creating the Customers Dimension


1. On the Designer tab, expand Dimensions and Cubes and OBE, right-click Dimensions, and then select New Dimension.

Description of this image

2. In the new dimension creation form, click the Definition tab and enter Customers in the Name field.
Under Binding, click Set the datastore for Dimensionnext to the Datastore field.

Description of this image.

3. In the Select Datastore dialog box, enter CUST in the Find field. Under BI_SALES, select CUSTOMERS_TAB, and
click OK.
Description of this image.

4. Repeat step 3 for Surrogate Key Sequence, entering CUST in the Find field, and selecting CUSTOMERS_SEQ

Description of this image.

5. In the ODI menu bar, click Save.

Defining the Levels Sections (Customers Dimension)


In the following sections, you create levels for Total, Region, SubRegion, Country, Province, City, and Customer.

Adding the Total Level


1. Click the Levels tab.

Description of this image.

2. In the Levels table, click Add. In the Name cell, change the name from Level1 to Total. In the Staging Datastore cell,
click the button to open the Select Datastore dialog box.

Description of this image.

3. In the Select Datastore dialog box, enter CUST in the Find field. Select CUSTOMERS_TOTAL_STG and click OK.
Description of this image.

4. In the Level Attributes table, click Add, and then enter or select the values listed in the following table. If the Size column
doesn't appear, click Select Columnsand select Size from the menu.
Name Surrogate_Key Data Type Size Attribute

Surrogate_Key (Select the check box.) NUMERIC TOTAL_SURROGATE_KEY

Natural_Key (Don't select the check box.) VARCHAR 40 TOTAL_NATURAL_KEY

Name (Don't select the check box.) VARCHAR 65 TOTAL_NAME

5. In the Natural Key Members table, click Add, and then enter Natural_Key.

Description of this image.

6. In the ODI menu bar, click Save.

Adding the Region Level


1. In the Levels table, click Add. In the Name cell, enter Region. In the Staging Datastore cell, click the button to open
the Select Datastore dialog box, then select BI_SALES.CUSTOMERS_REGION_STG and click OK.
Description of this image.

2. In the Level Attributes table, click Add, and then enter or select the values listed in the following table:
Name Surrogate_Key Data Type Size Attribute

Surrogate_Key (Select the check box.) NUMERIC REGION_SURROGATE_KEY

Natural_Key (Don't select the check box.) VARCHAR 40 REGION_NATURAL_KEY

Name (Don't select the check box.) VARCHAR 65 REGION_NAME

3. In the Natural Key Members table, click Add.

Description of this image.

4. In the Parent References table, click Add. In the Name cell, change the name
from PARENTREF1 to Region_of_Total. In the Parent Level cell, select Total. In the Parent Level Reference Key
Member table, confirm that the Parent Key Attribute cell shows CUSTOMERS_TAB.TOTAL_SURROGATE_KEY and that
the Foreign Key Attribute and Foreign Key Staging Attribute cells show TOTAL_SURROGATE_KEY.
Description of this image.

5. In the ODI menu bar, click Save.

Adding the Subregion Level


1. In the Levels table, click Add. In the Name cell, enter Subregion. In the Staging Datastore cell, click the button to open
the Select Datastore dialog box, then select BI_SALES.CUSTOMERS_SUBREGION_STG and click OK.

Description of this image.

2. In the Level Attributes table, click Add, and then enter or select the values in the following table:
Name Surrogate_Key Data Type Size Attribute

Surrogate_Key (Select the check box.) NUMERIC SUBREGION_SURROGATE_KEY

Natural_Key (Don't select the check box.) VARCHAR 40 SUBREGION_NATURAL_KEY

Name (Don't select the check box.) VARCHAR 65 SUBREGION_NAME

3. In the Natural Key Members table, click Add.


Description of this image.

4. In the Parent References table, click Add. Rename PARENTREF1 to Subregion_of_Region and select Region in
the Parent Level cell. In the Parent Level Reference Key Member table, confirm that the Parent Key Attribute field
shows CUSTOMERS_TAB.REGION_SURROGATE_KEY and that all other fields show REGION_SURROGATE_KEY.

Description of this image.

5. In the ODI menu bar, click Save.

Adding the Country Level


1. In the Levels table, click Add. In the Name cell, enter Country. In the Staging Datastore cell, click the button to open
the Select Datastore dialog box, then select BI_SALES.CUSTOMERS_COUNTRY_STG and click OK.
Description of this image.

2. In the Level Attributes table, click Add, and then enter or select the values listed in the following table:
Name Surrogate_Key Data Type Size Attribute

Surrogate_Key (Select the check box.) NUMERIC COUNTRY_SURROGATE_KEY

Natural_Key (Don't select the check box.) VARCHAR 40 COUNTRY_NATURAL_KEY

Name (Don't select the check box.) VARCHAR 65 COUNTRY_NAME

ISO (Don't select the check box.) VARCHAR 2 COUNTRY_ISO

3. In the Natural Key Members table, click Add.

Description of this image.

4. In the Parent References table, click Add. Rename PARENTREF1 to Country_of_SubRegion and select Subregion in
the Parent Level cell. In the Parent Level Reference Key Member table, confirm that the Parent Key Attribute cell
shows CUSTOMERS_TAB.SUBREGION_SURROGATE_KEY and that all other cells show SUBREGION_SURROGATE_KEY.
Description of this image.

5. In the ODI menu bar, click Save.

Adding the Province Level


1. In the Levels table, click Add. In the Name cell, enter Province. In the Staging Datastore cell, click the button to open
the Select Datastore dialog box, then select BI_SALES.CUSTOMERS_PROVINCE_STG and click OK.

Description of this image.

2. In the Level Attributes table, click Add, and then enter or select the values listed in the following table:
Name Surrogate_Key Data Type Size Attribute

Surrogate_Key (Select the check box.) NUMERIC PROVINCE_SURROGATE_KEY

Natural_Key (Don't select the check box.) VARCHAR 40 PROVINCE_NATURAL_KEY

Name (Don't select the check box.) VARCHAR 65 PROVINCE_NAME

3. In the Natural Key Members table, click Add.


Description of this image.

4. In the Parent References table, click Add. Rename PARENTREF1 to Province_of_Country. In the Parent Level cell,
select Country. In the Parent Level Reference Key Member table, confirm that the Parent Key Attribute cell
shows CUSTOMERS_TAB.COUNTRY_SURROGATE_KEY and that all other cells show COUNTRY_SURROGATE_KEY.

Description of this image.

5. In the ODI menu bar, click Save.

Adding the City Level


1. In the Levels table, click Add. In the Name cell, enter City. In the Staging Datastore cell, click the button to open
the Select Datastore dialog box, then select BI_SALES.CUSTOMERS_CITY_STG and click OK.
Description of this image.

2. In the Level Attributes table, click Add, and then enter or select the values in the following table:
Name Surrogate_Key Data Type Size Attribute

Surrogate_Key (Select the check box.) NUMERIC CITY_SURROGATE_KEY

Natural_Key (Don't select the check box.) VARCHAR 40 CITY_NATURAL_KEY

Name (Don't select the check box.) VARCHAR 65 CITY_NAME

3. In the Natural Key Members table, click Add.

Description of this image.

4. In the Parent References table, click Add. Rename PARENTREF1 to City_of_Province and select Province in
the Parent Level cell. In the Parent Level Reference Key Member table, confirm that the Parent Key Attribute cell
shows CUSTOMERS_TAB.PROVINCE_SURROGATE_KEY and that all other fields show PROVINCE_SURROGATE_KEY.
Description of this image.

5. In the ODI menu bar, click Save.

Adding the Customer Level


1. In the Levels table, click Add. In the Name cell, enter Customer.In the Staging Datastore cell, click the button to open
the Select Datastore dialog box, then select BI_SALES.CUSTOMERS_CUSTOMER_STG and click OK.

Description of this image.

2. In the Level Attributes table, click Add, and then enter or select the values in the following table:
Name Surrogate_Key Data Type Size Attribute

Surrogate_Key (Select the check box.) NUMERIC CUSTOMER_SURROGATE_KEY

Natural_Key (Don't select the check box.) VARCHAR 40 CUSTOMER_NATURAL_KEY

Name (Don't select the check box.) VARCHAR 65 CUSTOMER_NAME

Gender (Don't select the check box.) VARCHAR 10 CUSTOMER_GENDER

Street_Address (Don't select the check box.) VARCHAR 40 CUSTOMER_STREET_ADDRESS


Postal_Code (Don't select the check box.) VARCHAR 10 CUSTOMER_POSTAL_CODE

Phone_Number (Don't select the check box.) VARCHAR 25 CUSTOMER_PHONE_NUMBER

Email (Don't select the check box.) VARCHAR 30 CUSTOMER_EMAIL

3. In the Natural Key Members table, click Add.

Description of this image.

4. In the Parent References table, click Add. Rename PARENTREF1 to Customer_of_City and select City in the Parent
Level cell. In the Parent Level Reference Key Member table, confirm that the Parent Key Attribute cell
shows CUSTOMERS_TAB.CITY_SURROGATE_KEY and that all other fields show CITY_SURROGATE_KEY.

Description of this image.

5. In the ODI menu bar, click Save.


Defining the Hierarchies (Customers Dimension)
1. Click the Hierarchies tab. Click Add, rename HIERARCHY1 to CUSTOMERS_STD_HIER, and select the check box in
the Default column.

Description of this image.

2. For hierarchy members, click Add and then add the following levels, leaving the default values in the Parent Level
Reference column:
o Total
o Region
o Subregion
o Country
o Province
o City
o Customer

Description of this image.

3. In the ODI menu bar, click Save, and then click Validate. When the Successful Validation message appears, click OK and
close the Customers dimension tab in your workspace.

Creating the Sales Cube


1. On the Designer tab, expand Dimensions and Cubes and OBE, right-click Cubes, and then select New Cube.
Description of this image.

2. In the new cube creation form, click the Definition tab and enter Sales in the Name field. Under Binding, click Set the
datastore for Cube next to the Datastore field.
3. In the Select Datastore dialog box, enter SAL in the Find field. Under BI_SALES, select SALES_TAB, and click OK.

Description of this image.

4. Click the Details tab. In the Dimensions table, click Add, and then click the button in the Level field.
5. In the Select Level dialog box, under Times, select Day, and click OK.
Description of this image.

6. In the Key Binding table, for the End_Date row, enter TIMES in the Attribute field.

Description of this image.

7. Repeat steps 5, 6, and 7 to add the dimensions listed in the following table:
Dimension Level Key Binding Attribute

Channels.Channel CHANNELS

Products.Product PRODUCTS
Promotions.Promotion PROMOTIONS

Customers.Customer CUSTOMERS

8. Your Sales Cube Details page should look like the following image:

9. Description of this image.

10. At the bottom of the Details page, click Add for Measures, and then enter the values listed in the following table:
Name Data Type Size Scale Attribute Error Attribute

Amount NUMERIC 10 2 AMOUNT AMOUNT

Cost NUMERIC 10 2 COST COST

Quantity NUMERIC QUANTITY QUANTITY

11. Your Measures table should like the following image:

12. Description of this image.

13. Click Validate, click Save in the ODI menu bar, and then close the Sales Cube tab.

Mapping the Load Customers Dimension

Creating the Mapping


1. On the Designer tab, expand Projects, OBE, and Cubes and Dimensions, right-click Mappings and select New Mapping.
Description of this image.

2. In the New Mapping dialog box, enter Load Customers Dimension in the Name field, deselect Create Empty
Dataset, and click OK.

Description of this image.

3. On the Designer tab, expand Models and BI_XWEEK, then drag and
drop ADDRESSES, CITIES, COUNTRIES, CUSTOMERS, and REGIONS into the mapping area.
Description of this image.

Adding Components
1. In the Components palette, select DISTINCT, and drag and drop it into the mapping area,
between CUSTOMERS and REGIONS so that it's next to CITIES.
Description of this image.

2. In the mapping area, select DISTINCT_. In the DISTINCT_ - Properties pane, click the General tab, and
enter PROVS_ONLY in the Name field.
Description of this image.

3. Drag and drop STATE_PROVINCE and COUNTRY_ISO_CODE from CITIES into PROVS_ONLY.

Description of this image.

4. In the Components palette, select JOIN, and drag and drop it next to COUNTRIES and PROVS_ONLY in the mapping
area. Drag and drop the following into JOIN: ISO_CODE (COUNTRIES) and COUNTRY_ISO_CODE
(PROVS_ONLY).
Description of this image.

5. Select JOIN. In the JOIN - Properties pane, verify that PROVS_ONLY.COUNTRY.ISO_CODE =


COUNTRIES.ISO_CODE appears in the Join Condition field.

Description of this image.

6. In the Components palette, drag and drop JOIN next to CUSTOMERS and ADDRESSES in the mapping area.
7. Drag and drop the following into JOIN1: ID (CUSTOMERS) and CUSTOMER_ID (ADRESSES). In the JOIN1 -
Properties pane, verify that CUSTOMERS.ID = ADDRESSES.CUSTOMER_ID appears in the Join Condition field.
Description of this image.

8. To create a filter, drag and drop REGION_ID from REGIONS into the mapping area. In the FILTER - Properties pane,
enter is not null at the end of the Filter Condition field.

Description of this image.

9. In the FILTER - Properties pane, click the General tab and change FILTER to SUBREG_ONLY in the Name field.
Description of this image.

10. In the Components palette, drag and drop FILTER next to REGIONS in the mapping area. Drag and
drop REGION_ID from REGIONS to FILTER. In the FILTER - Properties pane, enter is null at the end of the Filter
Condition field.

Description of this image.

11. On the General tab of the FILTER - Properties pane, rename FILTER to REG_ONLY. On the Connector Points tab, in
the Connected From column, deselect SUBREG_ONLY, click No Selection and select REGIONS.
Description of this image.

Mapping Attributes
1. On the Designer tab, expand Dimensions and Cubes, OBE, and Dimensions. Drag and drop Customers into the mapping
area. On the General tab in the Customers1 - Properties pane, rename Customers1 to Customers_Dim.
Description of this image.

2. In the Components palette, drag and drop EXPRESSION into the mapping area. In the EXPRESSION - Properties pane,
click Add on the Attributes tab and enter the following values in the Attributes table:
o Name: TOTAL_NAME
o Data Type: VARCHAR
o Length: 20
o Expression: 'Customers_Total'
Description of this image.

3. Drag and drop TOTAL_NAME (EXPRESSION) to Total_Natural_Key and Total_Name (Customers_Dim).


4. Drag and drop ID (REGIONS) to Region_Natural_Key (Customers_Dim). In the Path Selection dialog box,
select REGIONS@REG_ONLY, then click OK.

Description of this image.

5. Drag and drop NAME (REGIONS) to Region_Name (Customers_Dim).


6. Select REF_Total_Natural_Key (Customers_Dim) and enter 'Customers_Total' in the Expression field in the
Properties pane.
Description of this image.

7. Drag and drop ID (REGIONS) to Subregion_Natural_Key (Customers_Dim). In the Path Selection dialog box,
select REGIONS@SUBREG_ONLY, then click OK.

Description of this image.

8. Map the following source attributes to the specified target attribute in Customers_Dim:
Source Model Source Attribute Target Attribute

REGIONS NAME SubRegion_Name

REGIONS REGION_ID REF_Region_Natural_Key

COUNTRIES ID Country_Natural_Key

COUNTRIES NAME Country_Name

COUNTRIES ISO_CODE Country_ISO

COUNTRIES REGION_ID REF_SubRegion_Natural_Key

PROVS_ONLY STATE_PROVINCE Province_Natural_Key

PROVS_ONLY STATE_PROVINCE Province_Name

COUNTRIES ID REF_Country_Natural_Key

CITIES ID City_Natural_Key

CITIES NAME City_Name

CITIES STATE_PROVINCE REF_Province_Natural_Key

CUSTOMERS ID Customer_Natural_Key

CUSTOMERS NAME Customer_Name

CUSTOMERS GENDER Customer_Gender

ADDRESSES CUST_STREET_ADDRESS Customer_Street_Address

ADDRESSES CUST_POSTAL_CODE Customer_Postal_Code

ADDRESSES PHONE_NUMBER Customer_Phone_Number

CUSTOMERS EMAIL Customer_Email

ADDRESSES CITY_ID REF_City_Natural_Key

9. Your mapping should look similar to the following image:


10. Description of this image.

11. Click the Physical tab and review the physical mapping.
Description of this image.

12. Click Validate the Mapping, click Save in the ODI menu bar, and then close the Load Customers Dimension tab.

Mapping the Load Sales Cube


1. On the Designer tab, expand Projects, OBE, and Cubes and Dimensions. Right-click Mappings and select New Mapping.

Description of this image.

2. In the New Mapping dialog box, enter Load Sales Cube for the name, verify that Create Empty Dataset is deselected,
and click OK.
Description of this image.

3. On the Designer tab, expand Models and BI_XWEEK, and then drag and
drop CHANNELS, ORDERS, and ORDER_ITEMS into the mapping area.

Description of this image.


4. Expand Dimensions and Cubes, OBE, and Cubes, and then drag and drop Sales into the mapping area.

Description of this image.

5. In the Components palette, drag and drop JOIN into the mapping area, next to ORDERS and ORDER_ITEMS.
Description of this image.

6. Drag and drop the following into JOIN: ID (ORDERS) and ORDER_ID (ORDER_ITEMS). In the JOIN -
Properties pane, verify that ORDERS.ID = ORDER_ITEMS.ORDER_ID appears in the Join Condition field.
Description of this image.

7. In the Components palette, drag and drop JOIN next to CHANNELS and ORDERS. Drag and drop the following
into JOIN1: CHANNEL (ORDERS) and NAME (CHANNELS). Verify that the join condition shows ORDERS.CHANNEL
= CHANNELS.NAME.
Description of this image.

8. Create a link between JOIN1 and Sales. In the Attribute Mapping dialog box, click OK. The mappings
for Sales.Amount, Sales.Cost, andSales.Quantity are done for you automatically.
Description of this image.

9. Map the following source attributes to the specified target attributes in the Sales cube object:
Source Model Source Attribute Target Attribute

ORDERS ORDER_FINISHED Times_End_Date

CHANNELS ID Channels_Natural_Key

ORDER_ITEMS PRODUCT_ID Products_Natural_Key

ORDERS PROMOTION_ID Promtions_Natural_Key

ORDERS CUSTOMER_ID Customer_Natural_Key

10. Your mapping should look similar to the following image:


11. Description of this image.

12. Click the Physical tab and review the physical mapping.
Description of this image.

13. Click Validate the Mapping, click Save in the ODI menu bar, and then close the Load Sales Cube tab.

Editing the Load Sales Cube Package


1. On the Designer tab, expand Projects, OBE, Cubes and Dimensions, and Packages. Double-click Load Sales Cube.
Description of this image.

2. Expand Mappings, and then drag and drop Load Customers Dimension into the Load Sales Cube package.
3. Click Next Step on Success, and then create a link between Load Products Dimension and Load Customers Dimension.

Description of this
image.

4. Repeat steps 2 and 3 for Load Sales Cube to creat a link between Load Customers Dimension and Load Sales Cube.

Description of this image.

5. In the package menu bar, click Execute the Package.


6. In the Run dialog box, click OK. After the information dialog box indicates that the session has started, click OK.
7. On the Operator tab, expand Session List, Date, and Today. Locate your session and verify that the session was successful (a
green check mark appears next to each task). If your session wasn't successful, double-click the failed session to view the
associated error messages.
ODI 12c SCD Type 2 Step by Step Implementation
ODI 12c SCD Type 2 is very easy compare to ODI 11G.

Please find the below steps for SCD Type 2 implementation.

I have created new target table to support SCD behaviour.

CREATE TABLE DEV.SCD


(
EMPLOYEE_ID NUMBER(6,0),
FIRST_NAME VARCHAR2(20 BYTE),
LAST_NAME VARCHAR2(25 BYTE) NOT NULL ENABLE,
EMAIL VARCHAR2(25 BYTE) NOT NULL ENABLE,
PHONE_NUMBER VARCHAR2(20 BYTE),
HIRE_DATE DATE NOT NULL ENABLE,
JOB_ID VARCHAR2(10 BYTE) NOT NULL ENABLE,
SALARY NUMBER(8,2),
COMMISSION_PCT NUMBER(2,2),
MANAGER_ID NUMBER(6,0),
DEPARTMENT_ID NUMBER(4,0),
STATUS_FLAG VARCHAR2(1 BYTE),
STARTING_DATE DATE,
ENDING_DATE DATE
) TABLESPACE SYSTEM ;

Step1:
------
Import IKM Oracle Slowly Changing Dimension Knowledge module.
Step2:
--------
Open Target SCD table and Change the SCD Behavior.
I have select SCD Behavior like below options.
Step3:
-------
Creating Mapping for Loading the data from Source table (hr.employees) table to
target table (dev.scd).
These three columns we are not receiving from Source , we need to map at direct target table
I have done mapping STATUS_FLAG=1 ( Default Active-1, Inactive-0),
STARTING_DATE=SYSDATE ,
ENDING_DATE = SYSDATE( But it will take default value from IKM SCD as 01-01-2400.
Selecting LKM SQL to SQL Knowledge module in Physical Tab
Selecting IKM Oracle Slowly Changing Dimension Knowledge Module
Selecting CKM SQL knowledge module for Data Quality validation at I$table.
Running Interface using Run button in Top Menu

Target table is empty as of now there is not records in target SCD table.
Program executed successfully. We can see the status as Green .
110 records are inserted as STATUS_FLAG=1 as New Records or active records.
UPDATE hr.employees SET salary=77777 WHERE employee_id=100;

COMMIT;

I have update data in source table and again i am running my mapping.

Program finished successfully.


ODI 12c SCD Type 2 Step by Step Implementation
ODI 12c SCD Type 2 is very easy compare to ODI 11G.

Please find the below steps for SCD Type 2 implementation.

I have created new target table to support SCD behaviour.

CREATE TABLE DEV.SCD


(
EMPLOYEE_ID NUMBER(6,0),
FIRST_NAME VARCHAR2(20 BYTE),
LAST_NAME VARCHAR2(25 BYTE) NOT NULL ENABLE,
EMAIL VARCHAR2(25 BYTE) NOT NULL ENABLE,
PHONE_NUMBER VARCHAR2(20 BYTE),
HIRE_DATE DATE NOT NULL ENABLE,
JOB_ID VARCHAR2(10 BYTE) NOT NULL ENABLE,
SALARY NUMBER(8,2),
COMMISSION_PCT NUMBER(2,2),
MANAGER_ID NUMBER(6,0),
DEPARTMENT_ID NUMBER(4,0),
STATUS_FLAG VARCHAR2(1 BYTE),
STARTING_DATE DATE,
ENDING_DATE DATE
) TABLESPACE SYSTEM ;

Step1:
------
Import IKM Oracle Slowly Changing Dimension Knowledge module.
Step2:
--------
Open Target SCD table and Change the SCD Behavior.

I have select SCD Behavior like below options.


Step3:
-------
Creating Mapping for Loading the data from Source table (hr.employees) table to
target table (dev.scd).
These three columns we are not receiving from Source , we need to map at direct target table
I have done mapping STATUS_FLAG=1 ( Default Active-1, Inactive-0),
STARTING_DATE=SYSDATE ,
ENDING_DATE = SYSDATE( But it will take default value from IKM SCD as 01-01-2400.
Selecting LKM SQL to SQL Knowledge module in Physical Tab

Selecting IKM Oracle Slowly Changing Dimension Knowledge Module


Selecting CKM SQL knowledge module for Data Quality validation at I$table.

Running Interface using Run button in Top Menu


Target table is empty as of now there is not records in target SCD table.

Program executed successfully. We can see the status as Green .


110 records are inserted as STATUS_FLAG=1 as New Records or active records.
UPDATE hr.employees SET salary=77777 WHERE employee_id=100;

COMMIT;

I have update data in source table and again i am running my mapping.


Program finished successfully.

One record got inserted as salary got changed it will Add row on change behavior
We can see the modified record inserted as new records and old record updated STATUS_FLAG=0
inactive record. STATUS-FLAG=1 is active for new records.

You might also like