8 copyright © 2009, oracle. all rights reserved. modeling multidimensional olap dimensions and...

63
8 Copyright © 2009, Oracle. All rights reserved. Modeling Multidimensional OLAP Dimensions and Cubes

Upload: melissa-gray

Post on 27-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

8Copyright © 2009, Oracle. All rights reserved.

Modeling Multidimensional OLAP Dimensions and Cubes

Copyright © 2009, Oracle. All rights reserved.8 - 2

Objectives

After completing this lesson, you should be able to:

• Use Warehouse Builder MOLAP dimension modeling capabilities– Value-based and skip-level hierarchies– Default hierarchy for multidimensional query tools

• Use Warehouse Builder MOLAP cube modeling capabilities– Conformed dimensions– Defining multiple cubes using the same dimensions at

different levels– Custom measures– Sparsity– Preaggregation

Copyright © 2009, Oracle. All rights reserved.8 - 3

Lesson Agenda

• OLAP concepts: Introduction

• Multidimensional data model– Measures– Dimensions– Hierarchies– Levels

• Analytic workspace

• Oracle Database 11g OLAP

• Warehouse Builder MOLAP dimension modeling

• Warehouse Builder MOLAP cube modeling

• Deploying MOLAP mappings

Copyright © 2009, Oracle. All rights reserved.8 - 4

What Is OLAP?

OLAP stands for online analytical processing.

• Online: You have access to live data (rather than static data).

• Analytical: You can analyze your data for reporting. You can create reports that are:– Multidimensional– Calculation-rich– Supported by time-based analysis– Ideal for applications with unpredictable, ad hoc query

requirements

Copyright © 2009, Oracle. All rights reserved.8 - 5

Examining an OLAP Question

• An OLAP question is a multidimensional query, as in the following:

“What was the percentage change in revenuefor a grouping of our top 20% products one year ago over a rolling three-monthtime period compared to the current periodthis year, for each region of the world?”

• This is a simple business question, but the actual query can be quite complex.

Copyright © 2009, Oracle. All rights reserved.8 - 7

Lesson Agenda

• OLAP concepts: Introduction

• Multidimensional data model– Measures– Dimensions– Hierarchies– Levels

• Analytic workspace

• Oracle Database 11g OLAP

• Warehouse Builder MOLAP dimension modeling

• Warehouse Builder MOLAP cube modeling

• Deploying MOLAP mappings

Copyright © 2009, Oracle. All rights reserved.8 - 8

Sales dimensioned by product, customer, and time

SALES cube

Product Customer

Time

Multidimensional Data Types

Data is stored in multidimensional cubes in the analytic workspace.

Copyright © 2009, Oracle. All rights reserved.8 - 9

Implementing a Dimensional Data Model with Multidimensional Data Types

You can use multidimensional data types when:

• Ad hoc usage patterns are unpredictable

• Query performance requirements are high

• The analytic requirements of the business include extended analytic, forecasting, and planning functionality

• Calculation requirementsare more extensive

• A data model that supports what-if analysis is required

Copyright © 2009, Oracle. All rights reserved.8 - 10

Dimensional Model

The multidimensional logical model has the following elements:

• Measures

• Dimensions

• Hierarchies

• Levels

• Attributes

Copyright © 2009, Oracle. All rights reserved.8 - 11

Measures

• Represent factual data (sometimes called “facts”; OWB groups measures in “cubes”)

• Are organized by one or more dimensions

• Populate the cells of a logical cube

• Can be numeric data, text, date, Boolean, and so on

Copyright © 2009, Oracle. All rights reserved.8 - 12

Measure Types

Measures are of two types:

• Stored measures:– Can store the result in a variable

• Calculated measures:– Can evaluate calculated data in a formula at query time

Stored Calculated

Copyright © 2009, Oracle. All rights reserved.8 - 13

Example of Measures in a Report

Storedmeasure

Calculatedmeasure

Crosstab report containing four measures:

Copyright © 2009, Oracle. All rights reserved.8 - 14

Dimensions

Dimensions:

• Form the “edges” ofthe measure

• Provide pointers tothe actual cellsinside themultidimensionalmeasures

Q1 Q2 Q3 Q4

Time

ProductAfrica

Europe

AsiaAmericas

SALES cube

RegionsLaptop

Camcorder

Camera

Monitor

Copyright © 2009, Oracle. All rights reserved.8 - 15

Example of Dimensions in a Report

Product

Time Customer Channel

Copyright © 2009, Oracle. All rights reserved.8 - 16

Quiz

Which of the following elements does the multidimensional logical model have?

a. Measures

b. Dimensions

c. Columns

d. Hierarchies

e. Levels

f. Attributes

g. Tables

Copyright © 2009, Oracle. All rights reserved.8 - 17

Hierarchies

• A hierarchy is a parent-child relationship among the members of a dimension.

• Hierarchies enable logical groupings of dimension members for the purposes of:– Navigation of data– Aggregation of measures– Allocation of data in a planning and budgeting application

• Dimensions usually have hierarchies.

Copyright © 2009, Oracle. All rights reserved.8 - 18

Hierarchy: Example

• Hierarchies enable you to navigate from the lowest level to the highest level, or from the highest to the lowest.

• You can aggregate data from the lowest level to the highest level.

SoftwareHardware

PCs Laptops Monitors X MY Z

L1 L2 L3 Y1 Y2 Y3

Total Product

Copyright © 2009, Oracle. All rights reserved.8 - 19

Levels

Levels

All Products

Category

Subcategory

Product

SoftwareHardware

PCs Laptops Monitors X MY Z

L1 L2 L3 Y1 Y2 Y3

Total Product

Copyright © 2009, Oracle. All rights reserved.8 - 20

Types of Hierarchy

Director

VP Admin

Admin

Director

VP

President

Day

Month

Quarter

Year

Level-basedhierarchy

Value-basedhierarchy

Director

Copyright © 2009, Oracle. All rights reserved.8 - 21

Attributes

• Attributes provide descriptive information about the dimension members.

• Attributes are also useful when you are selecting dimension members for analysis:– Select the products whose color (attribute) is “Blue.”– Select the customers who have two children. – Select the promotions that are of type “Multipack.”– Select all time periods whose description contains “January.”

Copyright © 2009, Oracle. All rights reserved.8 - 22

Attributes: Examples

Total

Karl

Karl

Bruce

Mary

John

John

Mary

Manager

Yellow sheets

Red sheets

White pillows

Red shirt

Green pants

Red pants

Blue shirt

Product

Yellow

Red

White

Red

Green

Red

Blue

Color

Sheets

Pillows

Bedding

Women’s

Men’s

Kids’

Clothing

SubcategoryCategory

Levels Attributes

Copyright © 2009, Oracle. All rights reserved.8 - 23

Dimensional Model Summarized

The multidimensional logical model has the following elements:

• Measures

• Dimensions– Hierarchies – Levels– Attributes

Time

Product

Customer

Item

Brand

Manufacturer

Month Quarter Year

Sales

Product Share

Sales Year to Date

Profit

Average Selling Price

Copyright © 2009, Oracle. All rights reserved.8 - 24

Lesson Agenda

• OLAP concepts: Introduction

• Multidimensional data model– Measures– Dimensions– Hierarchies– Levels

• Analytic workspace

• Oracle Database 11g OLAP

• Warehouse Builder MOLAP dimension modeling

• Warehouse Builder MOLAP cube modeling

• Deploying MOLAP mappings

Copyright © 2009, Oracle. All rights reserved.8 - 25

Analytic Workspace

• Is a container that holds multidimensional data and objects

• Is designed for efficient processing of multidimensional calculations

• Supports advanced calculations and rapid query performance

• Can be temporary or persistent

• Is a special table (LOB) in a tablespace (AW$tablename)

Copyright © 2009, Oracle. All rights reserved.8 - 26

Analytic Workspace

• Analytic workspaces are built using:– Oracle Warehouse Builder– Analytic Workspace Manager (AWM 11g)– AW XML API (for 10g form AWs)– OLAP Java API (for 11g form AWs)– OLAP DML

• An analytic workspace can be accessed by:– Business intelligence tools from Oracle– Business intelligence tools from partners– SQL– OLAP APIs

Copyright © 2009, Oracle. All rights reserved.8 - 27

Analytic Workspace: Creation and Maintenance Privileges

To create and maintain an analytic workspace, you must have the following:

• OLAP_USER role (automatically granted to an OWB run-time user when that user is created with OWB Repository Assistant)

• SELECT privileges on the source schema tables

• Sufficient quota on the tablespace in which the workspace is created

• SELECT, INSERT, and UPDATE privileges for the analyticworkspace

Copyright © 2009, Oracle. All rights reserved.8 - 28

OLAP DML

• Is a very powerful, multidimensional-aware language that enables developers to truly exploit the power of the OLAP option

• Supports the definition of multidimensional calculations, including customized calculations unique to your organization

• Contains an inventory of several hundred analytic functions

• Enables application developers to extend theanalytical capabilities of the AW

• Is accessible from the OWB Design Centeruser interface

Copyright © 2009, Oracle. All rights reserved.8 - 29

Lesson Agenda

• OLAP concepts: Introduction

• Multidimensional data model– Measures– Dimensions– Hierarchies– Levels

• Analytic workspace

• Oracle Database 11g OLAP

• Warehouse Builder MOLAP dimension modeling

• Warehouse Builder MOLAP cube modeling

• Deploying MOLAP mappings

Copyright © 2009, Oracle. All rights reserved.8 - 30

Tools to Build an Analytic Workspace

Cubebuilding

Extract, transform,load (ETL)

Oracle Warehouse Builder

Analytic Workspace Manager (AWM)

• OWB: Advanced ETL and AW deployment

• AWM: Builds an analytic workspace from clean data

Cleandata

Analyticworkspace

Source systems

Copyright © 2009, Oracle. All rights reserved.8 - 31

Quiz

An analytic workspace:

• Is a container that holds multidimensional data and objects

• Is designed for efficient processing of multidimensional calculations

• Supports advanced calculations and rapid query performance

• Is a special table (LOB) in a tablespace

a. True

b. False

Copyright © 2009, Oracle. All rights reserved.8 - 32

Lesson Agenda

• OLAP concepts: Introduction

• Multidimensional data model– Measures– Dimensions– Hierarchies– Levels

• Analytic workspace

• Oracle Database 11g OLAP

• Warehouse Builder MOLAP dimension modeling

• Warehouse Builder MOLAP cube modeling

• Deploying MOLAP mappings

Copyright © 2009, Oracle. All rights reserved.8 - 33

Dimensional Modeling

• Customers should need to think only about designing the dimension and cube, less about how the Oracle database stores data and performs extract, transform, load (ETL).

• Customers want to focus on product hierarchy; Oracle will figure out how and where to store data and perform ETL.

Copyright © 2009, Oracle. All rights reserved.8 - 34

Enabling OLAP Solutions

MOLAP?

SchemaLogicaldesign

AnalyticWorkspace

ETL

ETL

ROLAP?

AW created usingXML API to the

OLAP option

• Warehouse Builder 11g is capable of directly loading any data into the analytic workspace, allowing, for the first time, the wealth of transformation power on OLAP data loads.

• Create a logical design describing your OLAP cubes in dimensions, hierarchies, measures, calculated measures, and other components.

• Warehouse Builder uses the XML API to the OLAP option to directly create the AW and its objects and the metadata required in the database catalogs.

• After you have created your cubes and dimensions, use the Warehouse Builder ETL modelers to create the load programs, independent of storage decisions.

Copyright © 2009, Oracle. All rights reserved.8 - 35

Storage Management

• If you enter the name of an analytic workspace (AW) that does not exist, it will be created automatically when you deploy this object.

• If you do not specify an AW name, OWB will create an AW using the module name, as soon as you generate the dimensional object.

• If table space name is left blank, AW goes into the tablespace of the user.

Two choices for keys

Copyright © 2009, Oracle. All rights reserved.8 - 36

Dimensional Modeling Using OWB

Advanced modeling features enables full spectrum of dimensional capabilities, including:

• Value-based hierarchies

• Skip-level hierarchies

• And more

Copyright © 2009, Oracle. All rights reserved.8 - 37

Hierarchy Support: Value-Based

Day

Month

Quarter

Year

Level-basedhierarchy

Value-basedhierarchy

Adam

(VP)Smith

(Admin)

James

(Admin)

Bruce

(Director)

Jones

(VP)

KING (President)

Lex

(Director)Den

(Director)

Copyright © 2009, Oracle. All rights reserved.8 - 38

Create a Value-Based Hierarchy

Value-based hierarchies areonly for MOLAP dimensions.

Copyright © 2009, Oracle. All rights reserved.8 - 39

Lesson Agenda

• OLAP concepts: Introduction

• Multidimensional data model– Measures– Dimensions– Hierarchies– Levels

• Analytic workspace

• Oracle Database 11g OLAP

• Warehouse Builder MOLAP dimension modeling

• Warehouse Builder MOLAP cube modeling

• Deploying MOLAP mappings

Copyright © 2009, Oracle. All rights reserved.8 - 40

Calculated Measures

CUSTOMER

PRODUCT

TIME

Quantity Sold measure

X =

CUSTOMER

PRODUCT

TIME

PRODUCT

TIME

Unit Price measure

Revenue calculated measure

Quantity Price RevenueX =

Copyright © 2009, Oracle. All rights reserved.8 - 41

OWB Calculated Measures

Copyright © 2009, Oracle. All rights reserved.8 - 42

Generating Calculated Measures

Time Series

Share/Index

Rank

Copyright © 2009, Oracle. All rights reserved.8 - 43

Sparsity

If you mark a dimension as sparse, Warehouse Buildercreates a composite dimensionto manage sparse data.

Copyright © 2009, Oracle. All rights reserved.8 - 44

Compress Cube

Copyright © 2009, Oracle. All rights reserved.8 - 45

Partition Cube

Copyright © 2009, Oracle. All rights reserved.8 - 46

Cost-Based Aggregation

Cube wizard defaults to 20% of the lowest level of data to be precomputed.

Pre-aggregation slows the build, but speeds up queries.

Copyright © 2009, Oracle. All rights reserved.8 - 47

Level-Based Aggregation

Level-based aggregationis available for cubesdeploying to an Oracle release prior to 11g.

Copyright © 2009, Oracle. All rights reserved.8 - 48

Lesson Agenda

• OLAP concepts: Introduction

• Multidimensional data model– Measures– Dimensions– Hierarchies– Levels

• Analytic workspace

• Oracle Database 11g OLAP

• Warehouse Builder MOLAP dimension modeling

• Warehouse Builder MOLAP cube modeling

• Deploying MOLAP mappings

Copyright © 2009, Oracle. All rights reserved.8 - 49

Differences Between OLAP and Relational Loading

Differences between OLAP and relational deployment and loading:

Not much!(from the user perspective)

1. Deploy the data objects (dimensions and cubes).

2. Deploy the mappings.

3. Run the mappings to load data into an OLAP cube.

Copyright © 2009, Oracle. All rights reserved.8 - 50

No Relational Tables to Bind

Dimension Synchronize torepository object,

data stored inrelational table

Implementingtable

Dimension

Bind

ROLAP

MOLAP Deploy to DB,data stored in AW

Cube-organizedmaterialized view- Relational fact table- Summaries stored in AW

Schematable

AW

Copyright © 2009, Oracle. All rights reserved.8 - 51

Partially Predefined OLAP Module

Target module: SALES_AW

Target user: SALES_AW

• All dimensions are predefined.• All dimension-loading and cube-loading mappings are predefined.• Create the SALES cube.• Create the target user SALES_AW (test connecting with it in the SALES_AW_LOCATION).• Register SALES_AW_LOCATION with the DEFAULT_CONTROL_CENTER.• Deploy dimensions, cube, and mappings.• Execute mappings.

Sales

Customers Channels

Promotions

Times

Products

DB source module: XSALES

Channels, Promotions,Products, Addresses,Categories, Cities,Countries, Customers,Regions, Promo-subcategories, Promo-categories, Orders,Order_items

Mappings

Items in italicare predefined

SALES_AW module(mostly predefined)

Copyright © 2009, Oracle. All rights reserved.8 - 52

Examine the Predefined Dimensions and Mappings

You define the SALES cube.

Notice… no implementationtables!

Copyright © 2009, Oracle. All rights reserved.8 - 53

Define the Sales Cube

1. Define quickly and easily using a wizard.

2. Make further specifications using an editor.

Copyright © 2009, Oracle. All rights reserved.8 - 54

Create an OLAP Target User

Copyright © 2009, Oracle. All rights reserved.8 - 55

Specify Whether to Create a Location

Copyright © 2009, Oracle. All rights reserved.8 - 56

Location Created

Copyright © 2009, Oracle. All rights reserved.8 - 57

Associate the Module with the Target LocationModuleconfiguration

Controlcenter

Location

User

Copyright © 2009, Oracle. All rights reserved.8 - 58

Register the Target Location

Copyright © 2009, Oracle. All rights reserved.8 - 59

Deploying OLAP Objects with Control Center Manager

Deploying OLAPobjects to AW ismuch like deployingrelational objects.

Copyright © 2009, Oracle. All rights reserved.8 - 60

Executing OLAP Mappings

“Set based fail overto row based” is beingchosen as the defaultoperating mode.

Copyright © 2009, Oracle. All rights reserved.8 - 61

View Cube Data in the Data Viewer

CHANNELS dimension

AMOUNT, COST, QUANTITY measures

PRODUCTS dimension

Copyright © 2009, Oracle. All rights reserved.8 - 62

Quiz

In cubes, preaggregating slows the build, but speeds up the queries.

a. True

b. False

Copyright © 2009, Oracle. All rights reserved.8 - 63

Summary

In this lesson, you should have learned how to:

• Use Warehouse Builder MOLAP dimension modeling capabilities– Value-based and skip-level hierarchies– Default hierarchy for multidimensional query tools

• Use Warehouse Builder MOLAP cube modeling capabilities– Conformed dimensions– Defining multiple cubes using the same dimensions at

different levels– Custom measures– Sparsity– Preaggregation

Copyright © 2009, Oracle. All rights reserved.8 - 64

Practice 8-1: Overview

In the hands-on practice, you will perform the following:

• Work on a partially defined MOLAP project, including creation of a MOLAP cube