oracle olap

58

Upload: nik20132013

Post on 25-Nov-2015

58 views

Category:

Documents


7 download

TRANSCRIPT

  • OLAP Oracle

    Oracle CIS

  • Excel?

  • SQL> select t.empno,t.ename,t.sal,t.comm, sal+nvl(comm,0) summfrom emp t;

    EMPNO ENAME SAL COMM SUMM

    ----- ---------- --------- --------- ----------

    7369 SMITH 800,00 800

    7499 ALLEN 1600,00 300,00 19007499 ALLEN 1600,00 300,00 1900

    7521 WARD 1250,00 500,00 1750

    7566 JONES 2975,00 2975

    7654 MARTIN 1250,00 1400,00 2650

    7698 BLAKE 2850,00 2850

    7782 CLARK 2450,00 2450

    7788 SCOTT 3000,00 3000

    7839 KING 5000,00 5000

    7844 TURNER 1500,00 0,00 1500

    7876 ADAMS 1100,00 1100

  • select

    (select sal from emp where empno=7499)

    -

    (select sal from emp from emp where empno=7521) diff

    from dual;

    DIFF

    -----

    350

  • OLTP

  • OLTP

  • OLAP

  • Oracle OLAP DMLRPR hr_cube_sal(emp_id '7499')- hr_cube_sal(emp_id '7521)

    ( Excel- B10=A5-A6)

    TIME SAL

    ---------- ---------

    JAN10 350,00

    FEB10 350,00

    MAR10 450,00

  • OLAP DML SQL , 2009 100 000 -

    Select p.prod_name, g.geog_name, t.time_name, f.sales

    from fact f, proddim p, geogdim g, timedim twhere f.prod_id = p.prod_id and f.geog_id =

    g.geog_idand t.time_id = f.time_id and g.geog_id = NW'

    SQL

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

    OLAP DML

    and t.time_id = f.time_id and g.geog_id = NW'and t.time_id = 'OCT2009' and sales > 100000

  • SQL Model

    MODEL , .. ,

    SELECT * FROMsales s

    MODELDIMENSION 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, Express Server

    Oracle Hyperion Essbase Hyperion

  • Oracle OLAP(OLAP option)(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 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 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 ,

    , Parent- , Parent-Child

    ,

  • OLAP

    SQL

    .

  • VP Admin VP

    President

    - (parent-child)

    Director

    VP Admin

    Analyst

    Senior Director

    VP

    Director

    Admin

  • Analytic Workspace Manager

    Enterprise Manager OLAP AWM

  • 25

  • 26

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

  • Company75

    27

    75

    Brand40

    Item10

    Item30

    Brand35

    Item20

    Item15

  • 28

    2009175

    Q1165

    Jan125

    Feb140

    Mar165

    Q2145

    Apr135

    May120

    Jun145

    Q3110

    Jul130

    Aug155

    Sep110

    Q4175

    Oct120

    Nov165

    Dec175

  • c

    Company1,000 emp.$1,200,000

    29

    East750 emp.$900,000

    Southeast200 emp.$240,000

    Mid-Atlantic150 emp.$180,000

    Northeast400 emp.$480,000

    West250 emp.$300,000

    Midwest75 emp.$90,000

    West175 emp.$210,000

  • net_income = operating_income taxesoperating_income = gross_margin - (marketing +

    selling_exp + r_d)gross_margin = revenue - cogs

    30

    gross_margin = revenue - cogs

  • ,

    31

    VRB _alert NUMBERVRB _product NUMBER_product = product + 0TEMPSTAT product timeDOLIMIT product TO DESCENDANTS USING product_parentrel _productIF STATLEN(product) EQ 0THEN _alert = naELSE DOLIMIT product KEEP sales_cube_sales_ytd_pr_yr_pct LT 0AND sales_cube_sales_share_tot_pro GT .25IF STATLEN(product) GT 0THEN _alert = -1ELSE _alert = na

    DOENDDOENDRETURN _alert

  • 32

  • 33

    Percent Change in YTD Sales from Year Ago

  • Q1-04 Q2-04 Q3-04 Q4-04 Q1-05 Q2-05 Q3-05 Q4-05

    Q1-04 Q1-04

    Cumulative Total(or AVG, MIN, MAX)

    JAN04 FEB04 MAR04 APR04 MAY04 JUN04 JUL04 AUG04 SEP04 OCT04 NOV04 DEC04 JAN05 FEB05 MAR05 APR05 MAY05 JUN05 JUL05 AUG05 SEP05 OCT05 NOV05 DEC05

    SUM(sales) OVER HIERARCHY (global.time.calendar_year BETWEEN UNBOUNDED PRECEDING AND CURRENT MEMBER WITHIN ANCESTOR AT LEVEL global.time.calendar_year)

    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.

  • Q1-04 Q2-04 Q3-04 Q4-04 Q1-05 Q2-05 Q3-05 Q4-05

    Q1-04 Q1-04

    Percent Difference From Parallel Period

    JAN04 FEB04 MAR04 APR04 MAY04 JUN04 JUL04 AUG04 SEP04 OCT04 NOV04 DEC04 JAN05 FEB05 MAR05 APR05 MAY05 JUN05 JUL05 AUG05 SEP05 OCT05 NOV05 DEC05

    LAG_VARIANCE_PERCENT(global.units_cube.sales,1) OVER HIERARCHY (global.time.calendar_year BY ANCESTOR AT LEVEL global.time.year POSITION FROM BEGINNING)

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

  • -

    .

    , , , 450

    36

  • BusinessObjects

    CognosOracle BIEE

    Oracle Database 11g

    View

  • 11g Cube Fact View

    DESC units_cube_view;

    Name Null Type ------------------------- -------- --------------

    TIME VARCHAR2(100) CHANNEL VARCHAR2(100) CUSTOMER VARCHAR2(100) PRODUCT VARCHAR2(100)UNITS NUMBER SALES NUMBER

    Keys

    SALES NUMBER COST NUMBERSALES_PRIOR_PERIOD NUMBERSALES_DIFF_PRIOR_PERIOD NUMBERSALES_PCT_DIFF_PRIOR_PERIOD NUMBER

    Stored facts

    Calculated facts

  • 11g Cube Fact ViewSELECT time,product,customer,channel,units

    FROM units_cube_viewWHERE rownum < 15;

    TIME PRODUCT CUSTOMER CHANNEL UNITS--------- ------- -------- ------- ----------

    TOTAL TOTAL TOTAL TOTAL 4000968CY1999 TOTAL TOTAL TOTAL 330425CY2003 TOTAL TOTAL TOTAL 534069CY2003 TOTAL TOTAL TOTAL 534069CY1998 TOTAL TOTAL TOTAL 253816CY2005 TOTAL TOTAL TOTAL 565718CY2006 TOTAL TOTAL TOTAL 584929CY2004 TOTAL TOTAL TOTAL 587419CY2000 TOTAL TOTAL TOTAL 364233CY2002 TOTAL TOTAL TOTAL 364965CY2001 TOTAL TOTAL TOTAL 415394CY2000.Q1 TOTAL TOTAL TOTAL 88484CY2001.Q2 TOTAL TOTAL TOTAL 97346CY2001.Q3 TOTAL TOTAL TOTAL 105704CY2005.Q3 TOTAL TOTAL TOTAL 138953

    .

  • Cube ViewsExplain 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')'FEB2007')

    AND p.dim_key = 'ALL_PRODUCTS'AND g.level_name = 'REGION'AND c.dim_key = 'INTERNET'AND t.dim_key = f.TIMEAND p.dim_key = f.productAND g.dim_key = f.geographyAND c.dim_key = f.channel

    ORDER BY t.end_date;

  • (2 GB)

    3 ?

    x

    (30 GB)

    ( ( ))

    ( ( ))

    (, )

  • Materialized Views

    MV

    -

    MVEXPENSE_DETAIL EXPENSE_YDT

    Year, Region

    EXPENSE_MDTyear_iddistrict_idexpense_amountpotential_fraud_cost

    Month, District

    EXPENSE_MECmonth_idcategory_idemp_idexpense_amountpotential_fraud_cost

    Month, Employee, Category

    EXPENSE_YEC

    Year, Employee, Category

    EXPENSE_QDIqtr_iditem_iddistrict_idexpense_amountpotential_fraud_cost

    Qtr, District, Item

    MVday_iditem_idemp_idexpense_amountpotential_fraud_cost

    year_iddistrict_idexpense_amountpotential_fraud_cost

    EXPENSE_YECyear_idcategory_idemp_idexpense_amountpotential_fraud_cost

    EXPENSE_YRCyear_idcategory_idregion_idexpense_amountpotential_fraud_cost

    Year, Region, Category EXPENSE_XXXXXX_idXXX_idXXX_idexpense_amountpotential_fraud_cost

    Org Lvl, Time Lvl, Cat Lvl

    EXPENSE_XXX

    XXX_idXXX_idXXX_idexpense_amountpotential_fraud_cost

    EXPENSE_XXXXXX_idXXX_idXXX_idexpense_amountpotential_fraud_cost

    EXPENSE_XXXXXX_idXXX_idXXX_idexpense_amountpotential_fraud_cost

    EXPENSE_YRTyear_idtotal_category_idregion_idexpense_amountpotential_fraud_cost

    Year, District

  • 11g Cube-Organized Materialized Views

    SQLSQL

    SQL

    OLAP

    Cube MVCube OrganizedCube OrganizedMV MV

    Tables

    QueryQueryRewriteRewrite

    OLAP

    ,

    query rewrite ,

  • OLAP

    OLAP

    OLAP

    , OLAP

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

  • Simba MDX-OLAP Adapter

    MS EXCEL Pivot Table

    Simba MDX Adapter

    MDX

    Oracle OLAP

    ,

    ,

    Oracle Client

    SQL ()

  • OLAP 11g

    MOLAP Oracle

    MV

  • OLAP 11g BI EEOLAP 11g BI EE

  • OLAP Oracle OLAP ,

    .

    , OLAP ,

    , OLAP . OLAP .

    OLAP , .

    Olap 10g OLAP 9i, OLAP 11g OLAP 10g

  • Oracle HyperionEssbaseEssbase

  • Hyperion Essbase

    OLAP- ,

    / /

  • :

  • 350

  • Oracle OLAP Essbase

    Oracle OLAP Oracle .

    Oracle Essbase Essbase Oracle OLAP Essbase ,

    Essbase EPM Oracle

  • http://oracle.com

    Email:[email protected]

    :

    http://www.oraclebi.ru/