Вы находитесь на странице: 1из 58

<Insert Picture Here>

OLAP Oracle


Oracle CIS

Excel?


SQL> select t.empno,t.ename,t.sal,t.comm,

sal+nvl(comm,0) summ
from emp t;

EMPNO ENAME

SAL

COMM

SUMM

----- ---------- --------- --------- ---------800

7369 SMITH

800,00

7499 ALLEN

1600,00

300,00

1900

7521 WARD

1250,00

500,00

1750

7566 JONES

2975,00

7654 MARTIN

1250,00

7698 BLAKE

2850,00

2850

7782 CLARK

2450,00

2450

7788 SCOTT

3000,00

3000

7839 KING

5000,00

5000

7844 TURNER

1500,00

7876 ADAMS

1100,00

2975
1400,00

0,00

2650

1500
1100


select
(select sal
from emp
where empno=7499)
(select sal
from emp
where empno=7521) diff
from dual;

DIFF
----350

OLTP

OLTP

OLAP

Oracle OLAP DML


RPR hr_cube_sal(emp_id '7499')- hr_cube_sal(emp_id '7521)

( Excel-

TIME

B10=A5-A6)
SAL

---------- --------JAN10

350,00

FEB10

350,00

MAR10

450,00

OLAP DML SQL

SQL

OLAP
DML

, 2009
100 000 -
Select p.prod_name, g.geog_name, t.time_name,
f.sales
from fact f, proddim p, geogdim g, timedim t
where f.prod_id = p.prod_id and f.geog_id =
g.geog_id
and t.time_id = f.time_id and g.geog_id = NW'
and t.time_id = 'OCT2009' and sales > 100000

limit geography to NW'


limit time to 'OCT2009'
limit product to dollars gt 100000

SQL Model

MODEL
, .. ,



SELECT * FROM
sales s
MODEL
DIMENSION BY (Product,Version)
MEASURES (units,price,sale)
RULES UPSERT
(sale['Total','Total'] = SUM(sale)[ANY,ANY])

OLAP

C OLAP

(M)OLAP Oracle
Oracle Express Server
, , , OFA

Oracle OLAP option


Oracle, Express Server

Oracle Hyperion Essbase


Hyperion

Oracle OLAP
(OLAP option)

Oracle OLAP (1/2)


1967 Leonard M. Lodish John D.C. Little
Management Decision Systems (MDS)
1977 Software Development Laboratories (SDL),
Oracle. Larry Ellison,
Bob Miner Ed Oates.
1979 Oracle Version 2 (RDBMS)
1983 MDS Express C
AED.
1985 Information Resources, Inc. (IRI)
MDS. Express C
1993 E.F. Codd OLAP E.F.
Codd, S.B. Codd C.T. Salley
Providing OLAP to User-Analysts: An IT Mandate
12 OLAP

Oracle OLAP (2/2)


1995 Oracle Express IRI
1998-2000 Oracle Express 90
Express Oracle
2002 Oracle 9.2.0 Express Oracle
OLAP option
2004 10.1.0 OLAP SQL

2004 10.1.0 OLAP option


2005 10.2.0
2007 Oracle Database 11g
2007 Oracle Hyperion
2007 11.1 OLAP option query
rewrite
.

Oracle OLAP?
,
Oracle (MOLAP)


Oracle Express Server
..

(Analytical Workspaces)

Oracle OLAP Oracle

Oracle Database 11g

OLAP
,


, ParentChild


OLAP
SQL

-
(parent-child)

President

VP

Admin

VP

Director Director Senior Director

Admin

Analyst

Analytic Workspace Manager

Enterprise Manager OLAP


AWM

25

budget_cube.variance =
actual_cube.actual[geography TOTAL]
budget_cube.budget

26

Company
75

Brand
40

Item
10

Brand
35

Item
30

Item
20

Item
15

27

2009
175
Q1
165
Jan
125

Feb
140

Q2
145
Mar
165

Apr
135

May
120

Q3
110
Jun
145

Jul
130

Aug
155

Q4
175
Sep
110

Oct
120

Nov
165

Dec
175

28


c

Company
1,000 emp.
$1,200,000

East
750 emp.
$900,000

Southeast
200 emp.
$240,000

Mid-Atlantic
150 emp.
$180,000

West
250 emp.
$300,000

Northeast
400 emp.
$480,000

Midwest
75 emp.
$90,000

West
175 emp.
$210,000

29

net_income = operating_income taxes


operating_income = gross_margin - (marketing +
selling_exp + r_d)
gross_margin = revenue - cogs

30

VRB _alert
NUMBER
VRB _product
NUMBER
_product = product + 0
TEMPSTAT product time
DO
LIMIT product TO DESCENDANTS USING product_parentrel _product
IF STATLEN(product) EQ 0
THEN _alert = na
ELSE DO
LIMIT product KEEP sales_cube_sales_ytd_pr_yr_pct LT 0
AND sales_cube_sales_share_tot_pro GT .25
IF STATLEN(product) GT 0
THEN _alert = -1
ELSE _alert = na
DOEND
DOEND
RETURN _alert
31

32

Percent Change in YTD Sales from Year Ago

33

Cumulative Total
(or AVG, MIN, MAX)

Q1-04

Q1-04

JAN04

FEB04

Q2-04

MAR04

APR04

MAY04

Q1-04

Q3-04

JUN04

JUL04

AUG04

Q4-04

SEP04

OCT04

NOV04

Q1-05

DEC04

JAN05

FEB05

Q2-05

MAR05

APR05

MAY05

Q3-05

JUN05

JUL05

AUG05

Q4-05

SEP05

OCT05

Cumulative total (sum) of Sales in the Time dimension and Calendar Year hierarchy within ancestor at
level calendar year. Total from beginning member to current member.

SUM(sales) OVER HIERARCHY (global.time.calendar_year BETWEEN UNBOUNDED


PRECEDING AND CURRENT MEMBER WITHIN ANCESTOR AT LEVEL
global.time.calendar_year)

NOV05

DEC05

Percent Difference From Parallel


Period
Q1-04

Q1-04

JAN04

FEB04

Q2-04

MAR04

APR04

MAY04

Q1-04

Q3-04

JUN04

JUL04

AUG04

Q4-04

SEP04

OCT04

NOV04

Q1-05

DEC04

JAN05

FEB05

Q2-05

MAR05

APR05

MAY05

Q3-05

JUN05

JUL05

AUG05

Q4-05

SEP05

OCT05

Percent difference from parallel period for Sales in the Time dimension and Calendar Year hierarchy 1
Year ago based on position from the beginning of Year.

LAG_VARIANCE_PERCENT(global.units_cube.sales,1) OVER HIERARCHY


(global.time.calendar_year BY ANCESTOR AT LEVEL global.time.year POSITION
FROM BEGINNING)

NOV05

DEC05



-
.

, , , 450

36


Oracle BI
EE

Cognos

Business
Objects

View

Oracle Database 11g

11g Cube Fact View


DESC units_cube_view;
Name
Null
------------------------- -------TIME
CHANNEL
CUSTOMER
PRODUCT
UNITS
SALES
COST
SALES_PRIOR_PERIOD
SALES_DIFF_PRIOR_PERIOD
SALES_PCT_DIFF_PRIOR_PERIOD

Type
-------------VARCHAR2(100)
VARCHAR2(100)
VARCHAR2(100)
VARCHAR2(100)
NUMBER
NUMBER
NUMBER
NUMBER
NUMBER
NUMBER

Keys

Stored facts

Calculated facts

11g Cube Fact View


SELECT time,
product,
customer,
channel,
units
FROM units_cube_view
WHERE rownum < 15;
TIME
--------TOTAL
CY1999
CY2003
CY1998
CY2005
CY2006
CY2004
CY2000
CY2002
CY2001
CY2000.Q1
CY2001.Q2
CY2001.Q3
CY2005.Q3

PRODUCT
------TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL

CUSTOMER
-------TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL
TOTAL

CHANNEL
UNITS
------- ---------TOTAL
4000968
TOTAL
330425
TOTAL
534069
TOTAL
253816
TOTAL
565718
TOTAL
584929
TOTAL
587419
TOTAL
364233
TOTAL
364965
TOTAL
415394
TOTAL
88484
TOTAL
97346
TOTAL
105704
TOTAL
138953

Cube Views
Explain Plan
SELECT
t.long_description time,
g.long_description geography,
c.long_description channel,
f.sales sales
FROM time_calendar_view t,
product_standard_view p,
geography_regional_view g,
channel_sales_channel_view c,
sales_cube_view f
WHERE t.dim_key IN('CY2007','Q1CY2007',
'FEB2007')
AND p.dim_key = 'ALL_PRODUCTS'
AND g.level_name = 'REGION'
AND c.dim_key = 'INTERNET'
AND t.dim_key = f.TIME
AND p.dim_key = f.product
AND g.dim_key = f.geography
AND c.dim_key = f.channel
ORDER BY t.end_date;


(,

)


(2 GB)


3
?

(
)

(30 GB)

Materialized Views

Month, Employee, Category

Qtr, District, Item

Month, District

EXPENSE_MEC

EXPENSE_QDI

EXPENSE_MDT

month_id
category_id
emp_id
expense_amount
potential_fraud_cost

qtr_id
item_id
district_id
expense_amount
potential_fraud_cost

year_id
district_id
expense_amount
potential_fraud_cost

Year, Employee, Category

EXPENSE_YEC
year_id
category_id
emp_id
expense_amount
potential_fraud_cost
Year, Region, Category

Year, Region

EXPENSE_DETAIL

EXPENSE_YDT

day_id
item_id
emp_id
expense_amount
potential_fraud_cost

year_id
district_id
expense_amount
potential_fraud_cost

Year, District

EXPENSE_YRC

EXPENSE_YRT

year_id
category_id
region_id
expense_amount
potential_fraud_cost

year_id
total_category_id
region_id
expense_amount
potential_fraud_cost

Org Lvl, Time Lvl, Cat Lvl

EXPENSE_XXX
EXPENSE_XXX
XXX_id
XXX_id
EXPENSE_XXX
XXX_id
XXX_id
EXPENSE_XXX
expense_amount
XXX_id
XXX_id
potential_fraud_cost
XXX_id
XXX_id
XXX_id
XXX_id
XXX_id
expense_amount
expense_amount
XXX_id
potential_fraud_cost
potential_fraud_cost
expense_amount
potential_fraud_cost

MV


MV

11g Cube-Organized Materialized Views

SQL

Query
Rewrite

Tables

Cube MV

Cube Organized
MV




SQL

OLAP


,
query rewrite
,

OLAP
OLAP
OLAP
, OLAP


Oracle OLAP MDX Driver (http://simba.com)

Simba MDX-OLAP Adapter


MS EXCEL Pivot Table

MDX

Simba MDX Adapter

()

SQL

Oracle Client

Oracle OLAP

,
,

OLAP 11g

MOLAP

Oracle
MV

OLAP 11g BI EE

OLAP

Oracle OLAP ,
.

, OLAP
,

,

OLAP .

OLAP ,

.

Olap 10g OLAP 9i, OLAP 11g


OLAP 10g

Oracle Hyperion
Essbase

Hyperion Essbase
OLAP- ,



/

350

Oracle OLAP Essbase


Oracle OLAP Oracle
.

Oracle

Essbase
Oracle OLAP Essbase ,

Essbase EPM
Oracle


http://oracle.com
Email:
Andrey.Pivovarov@oracle.com
:
http://www.oraclebi.ru/