Ex 1. Rel Dim Design
Transcript of Ex 1. Rel Dim Design
-
7/31/2019 Ex 1. Rel Dim Design
1/43
Warehouse Builder Dimensional Design
Dimensional Design
Dimensional Design with
Oracle Warehouse Builder
Purpose
In this excercise you will create a datamodel in dimensional form supports a sales order cube.
TopicsThis excercise covers the following topics:Prerequisites
Introduce the OE system as sourceDesign of the dimensional data Model
APPENDIX Using OWB for Dimensional Design
Prerequisites
The 1. module
Also it is a good idea to read the APPENDIX Using OWB for Dimensional Design at the end of thisexercise.
Design of the dimensional data Model
Create a cube structure that handles a sales cube.
The stucture must be based on a dimensional design.
Step 1
Create a new project for your Datawarehouse project
Create a new module OE that is a source module
In the location the username/password for the user is oe/oe.
Import the following tables : order_items, customer, products, employees.
Hint : Make sure you have One level set.
Page 1 of 43
-
7/31/2019 Ex 1. Rel Dim Design
2/43
Warehouse Builder Dimensional Design
Dimensional Design
Step 2
Customer X has asked you to design a new BI system for them, that can handle the reporting ofsales orders over time. Therefor you have conducted a set of interviews with differentrepresentatives from customer X too find out which needs customer X has regarding their reporting.
Based on these interviews, you have identified certain needs in connection with the desired reports.And you have identified that as a minimum the following attributes must be present in the cube :
Customer numberAddressDelivery dateCityCreated dateOrder numberPayment dateItem numberUnitsPrice per itemItem textCustomer nameZip CodeSalespersonDepartmentSales persons name (first and last)
It is up to you to find good find names (eihter in Danish or English) for the datamodel. Also youshould asure that all attributes you would like in the datamodel is present.
Hint 1 : Your cube should as a minimum consist of 4 dimensions and 1 cube
Hint 2 : REMEMBER that normalization is NOT ALLOWED !!!!!
Hint 3 : Look at the source system
Step 3
Create a new Oracle Module for the DW. Use your username in the location settings.
Create dimensions and cube(s) necessary for your datamodel.
Asure that each dimension has a good set of levels and hierachies.
Page 2 of 43
-
7/31/2019 Ex 1. Rel Dim Design
3/43
Warehouse Builder Dimensional Design
Dimensional Design
Step 4
When the design is finished deploy it to your datawarehouse.
Page 3 of 43
-
7/31/2019 Ex 1. Rel Dim Design
4/43
Warehouse Builder Dimensional Design
Dimensional Design
APPENDIX Using OWB for Dimensional
Design
Overview
Oracle Warehouse Builder provides advanced relational and dimensional modeling capab-
ilities. It enables you to create definitions for relational objects such as Tables, Views, Ma-
terialized Views, Sequences, and External Tables and dimensional target objects such asDimensions and Cubes.
Oracle Warehouse Builder explicitly separates dimensional design from physical imple-
mentation. You can choose either a relational implementation or a multidimensional imple-
mentation for the dimensional objects using a simple click operation. Therefore, the same
dimensional object design can be implemented as a relational target warehouse or a multi-
dimensional (implemented in OLAP) warehouse.
In this lesson, you design a dimensional model implemented as a relational target ware-
house. For relational modeling, Warehouse Builder supports the design and implementationof bothStar and Snowflake schemas.
You also model a simple star schema consisting of a cube with foreign key references totwo dimensions.
Defining a Target Warehouse ModuleTo begin designing the model of your target warehouse, you can start by defining a target
module. Target modules contain the metadata definition of the target objects you design.Every target module must be mapped to a target user schema.
Therefore, before you create a Warehouse Builder target module, you need to create a tar-
get schema that will physically store your target objects on deployment. Then, you makesure that the target module references this target schema by assigning an appropriate loca-
tion.
Create a Target Module
1.
In the your project, expand the Databases node, right-click the Oracle node, and select
New.
Page 4 of 43
http://www.oracle.com/technology/obe/10gr2_owb/owb10gr2_gs/owb/lesson3/starandsnowflake.htmhttp://www.oracle.com/technology/obe/10gr2_owb/owb10gr2_gs/owb/lesson3/starandsnowflake.htmhttp://www.oracle.com/technology/obe/10gr2_owb/owb10gr2_gs/owb/lesson3/starandsnowflake.htm -
7/31/2019 Ex 1. Rel Dim Design
5/43
Warehouse Builder Dimensional Design
Dimensional Design
The Create Module Wizard is launched. ClickNext on the Welcome page.
2.
On the Name and description page, enterYOUR DW NAME as the name of the module.
Accept Development as the module status and ensure that Warehouse Target is selected
as the module type. ClickNext.
Page 5 of 43
-
7/31/2019 Ex 1. Rel Dim Design
6/43
Warehouse Builder Dimensional Design
Dimensional Design
3.
On the Connection information page, from the Location drop-down , select YOUR DW
NAME_LOCATION as the location of the module. Observe that all the relevant connec-
tion details are already specified. This is because Warehouse Builder derives the locationinformation directly from the user you created. ClickNext.
Note: Before you selected YOUR DW NAME_LOCATION from the Location drop-down , YOUR DW NAME_LOCATION1 was selected by default. This is because
whenever you try to create a module, Warehouse Builder automatically assigns a location
with _LOCATION suffixed to the module name.
You have selected the location, YOUR DW NAME_LOCATION, which was created when
you created the YOUR DW NAME target user.
Page 6 of 43
-
7/31/2019 Ex 1. Rel Dim Design
7/43
Warehouse Builder Dimensional Design
Dimensional Design
On the Summary page, examine the details and clickFinish.
4.
Observe that the YOUR DW NAME target module has been added under the Oracle nodeof the YOUR PROJECT project. Expand YOUR DW NAME and examine its contents.
Page 7 of 43
-
7/31/2019 Ex 1. Rel Dim Design
8/43
Warehouse Builder Dimensional Design
Dimensional Design
Until now, you have created an empty target module YOUR DW NAME that maps to an
empty target schema YOUR DW NAME. Now, you start designing your target objects inthis target module.
Designing Dimensions
Dimensions are the primary organizational unit of data in a star schema. Examples of some
commonly used dimensions are Customer, Product, and Time.
A dimension consists of a set of levels and a set of hierarchies defined using these levels.Users often analyze data by drilling down on known dimension hierarchies. The query per-formance is improved because the query optimizer makes smart decisions about choosing
what data to use.
To create a dimension, you must define the following:
Dimension Attributes
Page 8 of 43
-
7/31/2019 Ex 1. Rel Dim Design
9/43
Warehouse Builder Dimensional Design
Dimensional Design
Levels
Level Attributes
Hierarchies
This topic introduces you to a basic example of a dimension. Before creating dimensions,
you examine an existing one to understand the basic design of a dimension.
Let us examine a fictive PRODUCTS dimension for its dimension attributes, levels, andhierarchies.
1.
In the Project Explorer panel, you would expand YOUR PROJECT > Databases > Or-acle. Expand YOUR DW, and then expand Dimensions. Right-clickPRODUCTS and se-
lect Open Editor.
Note: Alternatively, you can also double-click PRODUCTS.
The Data Object Editor is launched. The Data Object Editor is the single interface where
you can easily design, create, and manage a variety of database or dimensional objects. The
Data Object Editor is a central place where you can build or modify various warehouseschema designs through the use of diagrams and property sheets. This is how the interface
looks:
Page 9 of 43
-
7/31/2019 Ex 1. Rel Dim Design
10/43
-
7/31/2019 Ex 1. Rel Dim Design
11/43
Warehouse Builder Dimensional Design
Dimensional Design
Note: The dimension key column is the primary key for the dimension and implements thesurrogate identifier of each level. Using a sequence, you can populate the dimension key
with unique values.
A surrogate identifier uniquely identifies each level record across all the levels of the di-
mension and is loaded from a sequence, as specified in the dimension key field.
A business identifier is an attribute that is always derived from the natural key of the datasource.
A parent identifier is also available when you want to use value-based hierarchies.
In the Descriptor column, the dimension attributes marked as Long Description and ShortDescription are the ones used to display the dimension members in BI Beans.
Click in the Name column and add two DATE attributes, VALID_FROM_DATE and
VALID_TO_DATE, with the following details, as shown in the screenshot.
3.
To view the dimension levels and level attributes, click the Levels tab in the Dimension
Details panel. Observe that there are four levels and each level has an applicable set of at-
tributes, for example PRODUCT level implements all the dimension attributes as level at-
tributes, except the two date attributes that you added in the previous step.
To include the two date attributes as applicable attributes for the PRODUCT level, select
the Applicable check boxes forVALID_FROM_DATE and VALID_TO_DATE attrib-utes, as shown in the screenshot.
Page 11 of 43
-
7/31/2019 Ex 1. Rel Dim Design
12/43
Warehouse Builder Dimensional Design
Dimensional Design
Note: A level is not required to implement all dimension attributes. Implementing a dimen-sion attribute on a level enables you to store this information on a level.
In a relational implementation, a level attribute becomes a column in a table. Level attrib-utes do not have to have the same name as the dimension attribute, but Warehouse Builder
defaults it as such in the panel.
When defining the levels you need not worry about the order in which you enter the levels.The levels are only organized in the hierarchies.
4.
To view the dimension hierarchy, click the Hierarchies tab in the Dimension Details pan-
el. Observe that there is only one hierarchy, PROD_STD, with levels arranged in a particu-
lar order (top down in the panel ).
The Default check box allows you to select a hierarchy that will display when a user quer-ies. So it is important to pick the most commonly used hierarchy for this.
Page 12 of 43
-
7/31/2019 Ex 1. Rel Dim Design
13/43
Warehouse Builder Dimensional Design
Dimensional Design
5.
When you define a dimension, you can also specify the slowly changing dimensionstrategy.
Slowly Changing Dimensions determine how you store historical changes to your dimen-sion values. You can choose between the three strategies, as shown in the screenshot.
Click the SCD tab to view the slowly changing dimension strategy for the PRODUCTS di-mension.
If you want to store the complete change history, you would use a type 2 implementation.Select Type2: Store the complete change history. Notice that the Settings button is en-
abled. ClickSettings.
Page 13 of 43
-
7/31/2019 Ex 1. Rel Dim Design
14/43
Warehouse Builder Dimensional Design
Dimensional Design
In the Type 2 slowly changing policy dialog box, in the Record History drop-down , youneed to specify the attributes as:
Trigger History: Select this option for an attribute if a change in the attribute's data element requires the
record to create a new version of itself.
Effective Date: Set this option for the single attribute if it stores the value of the date/time the recordbecomes active.
Expiration Date: Set this option for the single attribute that stores the date/time the record is no longer
valid or effective.
For example, to record the change history whenever the _PRICE, NAME and PACK SIZEof a product changes, set them as Trigger History attributes, as shown in the screenshot.
Also, VALID_FROM_DATE is set as Effective Date and VALID_TO_DATE is set as
Expiration Date attributes.
ClickClose in the Type 2 slowly changing policy dialog box.
Page 14 of 43
-
7/31/2019 Ex 1. Rel Dim Design
15/43
-
7/31/2019 Ex 1. Rel Dim Design
16/43
Warehouse Builder Dimensional Design
Dimensional Design
Warehouse Builder enables you to not only create but also populate time dimensions.When you create a time dimension using the wizard, Warehouse Builder automatically cre-
ates the mapping for you to populate the time dimension.
Also, the data loaded into the time dimension conforms to the OLAP standards regarding
attributes for a time dimension.
Now, you perform the steps to create the REL_TIME dimension using the Time DimensionWizard.
1.
You were previously examining the YOUR DW module. Now, expand YOUR DW
NAME, right-clickDimensions and select New > Using Time Wizard.
The Create Time Dimension Wizard is launched. ClickNext on the Welcome Page.
2.
Page 16 of 43
-
7/31/2019 Ex 1. Rel Dim Design
17/43
Warehouse Builder Dimensional Design
Dimensional Design
On the Name and Description page, enterREL_TIME as the name of the dimension. Click
Next.
3.
On the Storage page, select Relational Storage (ROLAP) to specify relational implement-
ation of the dimension. ClickNext.
Page 17 of 43
-
7/31/2019 Ex 1. Rel Dim Design
18/43
Warehouse Builder Dimensional Design
Dimensional Design
4.
On the Data Generation page, you specify the range of time data that is required for your
warehouse. This information is used to generate a mapping that populates the time dimen-
sion. Within this mapping, the dates you enter are added as parameters, allowing you to re-run this mapping with dates at a later stage.
For Start Year, enter2003 and for Number of Years enter3. Ensure that Calendar is selec-ted, as shown in the screenshot.
Note: A hierarchy defines hierarchical relationships between adjacent levels in a time di-
mension. A time dimension can have one or more hierarchies. Each hierarchy must beeither a fiscal hierarchy or a calendar hierarchy.
If your time dimension contains fiscal data, you must specify the start month and day forthe fiscal year and start
day for the fiscal week. You also need to specify month and quarter boundary convention
that can be 445 or 544.
Page 18 of 43
-
7/31/2019 Ex 1. Rel Dim Design
19/43
Warehouse Builder Dimensional Design
Dimensional Design
5.
On the Levels page, select Normal Hierarchy and select all the levels: Calendar Year,
Calendar Quarter, Calendar Month and Day. ClickNext.
Page 19 of 43
-
7/31/2019 Ex 1. Rel Dim Design
20/43
Warehouse Builder Dimensional Design
Dimensional Design
6.
On the Pre Create settings page, examine the details and clickNext.
Page 20 of 43
-
7/31/2019 Ex 1. Rel Dim Design
21/43
Warehouse Builder Dimensional Design
Dimensional Design
A progress bar shows the progress as the wizard creates the necessary objects.
Page 21 of 43
-
7/31/2019 Ex 1. Rel Dim Design
22/43
-
7/31/2019 Ex 1. Rel Dim Design
23/43
-
7/31/2019 Ex 1. Rel Dim Design
24/43
Warehouse Builder Dimensional Design
Dimensional Design
The Create Dimension Wizard is launched. ClickNext on the Welcome Page.
2.
On the Name and Description page, enterREL_CATEGORY as the name of the dimen-sion. ClickNext.
Page 24 of 43
-
7/31/2019 Ex 1. Rel Dim Design
25/43
Warehouse Builder Dimensional Design
Dimensional Design
3.
On the Storage Type page, select Relational Storage (ROLAP) to specify the relational
implementation of the dimension. ClickNext.
Page 25 of 43
-
7/31/2019 Ex 1. Rel Dim Design
26/43
Warehouse Builder Dimensional Design
Dimensional Design
4.
On the Dimension Attributes page, you find three predefined columns, ID, NAME, and
DESCRIPTION. Note that for the ID attribute, the identifier is set as Surrogate and for
the Name attribute the identifier is set as Business.
You can change these attributes to your liking, but must have a surrogate and a business
identifier in the . The surrogate identifier must have the NUMBER data type.
For the NAME attribute, change Length to 30. ClickNext.
Page 26 of 43
-
7/31/2019 Ex 1. Rel Dim Design
27/43
Warehouse Builder Dimensional Design
Dimensional Design
5.
On the Levels page, specify the following levels for the default hierarchy in the dimension:
CATEGORY (Description: Accounting Category)
TYPE (Description: As entered on Expense Report)
Page 27 of 43
-
7/31/2019 Ex 1. Rel Dim Design
28/43
-
7/31/2019 Ex 1. Rel Dim Design
29/43
Warehouse Builder Dimensional Design
Dimensional Design
7.
On the Slowly Changing Dimension page, leave the default slowly changing dimension op-
tion selected. ClickNext.
Page 29 of 43
-
7/31/2019 Ex 1. Rel Dim Design
30/43
-
7/31/2019 Ex 1. Rel Dim Design
31/43
Warehouse Builder Dimensional Design
Dimensional Design
Designing Cubes/Facts
Cubes contain measures and link to one or more dimensions. The axes of a cube contain di-mension values and the body of the cube contains measure values. Most measures are nu-
meric and additive. For example, sales data can be organized into a cube whose edges con-tain values for Time, Product, and Customer dimensions and whose body contains valuesfrom the measures Value sales and Dollar sales.
In a relational implementation, a cube is linked to dimension tables by foreign key con-straints and consists of a set of measures. To create a cube, you must define the following:
Cube MeasuresCube Dimensionality
Let us examine a fictive SALES cube for its measures and dimensionality.
This topic introduces you to an example of a cube. By examining an existing cube that hasbeen predefined for you, you will understand the basic design of a cube. Later in the topic,
you create a simple cube with reference to expenses scenario using the wizard.
1.
In the Project Explorer panel, expand YOUR PROJECT > Databases > Oracle. Expand
YOUR DW, and then expand Cubes. Right-clickSALES and select Open Editor.
Page 31 of 43
-
7/31/2019 Ex 1. Rel Dim Design
32/43
Warehouse Builder Dimensional Design
Dimensional Design
Note: Alternatively, you can also double-click SALES.
The Data Object Editor launches.
2.
In the Dimensional panel in the middle, scroll up or down to understand the design dia-gram. You will observe that the SALES cube is linked to five dimensions: PRODUCTS,CHANNELS, CUSTOMERS, PROMOTIONS, and TIMES.
Page 32 of 43
-
7/31/2019 Ex 1. Rel Dim Design
33/43
-
7/31/2019 Ex 1. Rel Dim Design
34/43
Warehouse Builder Dimensional Design
Dimensional Design
4.
To examine the measures of the SALES cube, click the Measures tab in the Cube Detailspanel. Note that there are three measures and all of them are numeric. These measures canbe aggregated to determine the total sales cost, amount, or quantity across a period of time
or for a particular customer or for a particular product.
5.
Click the Aggregation tab to define the aggregations that must be performed for each di-
mension that the cube references.
You select the aggregate function that is used to aggregate data. You can also precompute
measures along each dimension that the cube references. The default aggregate function is
SUM.
You specify the following:
Page 34 of 43
-
7/31/2019 Ex 1. Rel Dim Design
35/43
Warehouse Builder Dimensional Design
Dimensional Design
Cube Aggregation Method: Select the aggregate function used to aggregate the cube data. The default
selection is SUM.
Summary Refresh Method: Select the data refresh method. The options you can select are On Demand
and On Commit.
Summary Strategy for Cube: Define the levels along which data should be precomputed for each
dimension.
6.
You can implement a cube in a relational form or a multidimensional form in the database.In relational implementation, a relational table stores the cube data. When a cube is imple-
mented in a multidimensional environment, the cube data is stored in an analytic work-
space.
If you want to modify the physical implementation of the cube, click the Storage tab in the
Cube Details panel. You can select between relational or multidimensional implementation.
For relational implementation of the cube, you can opt to create bitmap indexes. Having
these indexes on the cube improves your performance at query time.
Page 35 of 43
-
7/31/2019 Ex 1. Rel Dim Design
36/43
Warehouse Builder Dimensional Design
Dimensional Design
As for dimensions, you can view the cube data in the Data Viewer. From the Diagram
menu, select Close Window to exit the Data Object Editor.
Create REL_EXPENSE Cube Using the Wizard
Now, you design a simple relational cube, REL_EXPENSE. This cube references the two
dimensions, REL_TIME and REL_CATEGORY, which you created in previous steps. Thewizard helps you create a cube in a few easy steps.
1.
You were previously examining the YOUR DW module. Now, switch to the YOUR DW
NAME module, right-clickCubes, and select New > Using Wizard.
Page 36 of 43
-
7/31/2019 Ex 1. Rel Dim Design
37/43
Warehouse Builder Dimensional Design
Dimensional Design
The Create Cube Wizard is launched. ClickNext on the Welcome Page.
2.
On the Name and Description page, enterREL_EXPENSE as the name of the cube. Click
Next.
Page 37 of 43
-
7/31/2019 Ex 1. Rel Dim Design
38/43
Warehouse Builder Dimensional Design
Dimensional Design
3.
On the Storage Type page, select ROLAP: Relational Storage to specify relational imple-
mentation of the cube. ClickNext.
Page 38 of 43
-
7/31/2019 Ex 1. Rel Dim Design
39/43
-
7/31/2019 Ex 1. Rel Dim Design
40/43
-
7/31/2019 Ex 1. Rel Dim Design
41/43
Warehouse Builder Dimensional Design
Dimensional Design
On the Summary page, review the cube details and clickFinish.
Observe that REL_EXPENSE cube is added under the Cubes node of the YOUR DWNAME module. To view the cube in the Data Object editor, right-clickREL_EXPENSEand select Open Editor or double-clickREL_EXPENSE. Examine the cube, and then
close the Data Object Editor.
Page 41 of 43
-
7/31/2019 Ex 1. Rel Dim Design
42/43
Warehouse Builder Dimensional Design
Dimensional Design
From the Design menu, select Save All to commit your work.
In this lesson, you created two external tables mapped to the two previously sampled
source flat files, two dimensions, REL_TIME and REL_CATEGORY, and a cubeREL_EXPENSE linked to the two dimensions.
Page 42 of 43
-
7/31/2019 Ex 1. Rel Dim Design
43/43
Warehouse Builder Dimensional Design
Dimensional Design