SlideShare una empresa de Scribd logo
1 de 178
Oracle Technical Workshop
Oracle Data Warehouse & Business Intelligence Solution
Oracle 10g OLAP
OLAP 技术背景
      60 年代,关系数据库之父 E.F.Codd 提出了关系模型,促进了联
       机事务处理 (OLTP) 的发展 ( 数据以表格的形式而非文件方式存
       储 ) 。 1993 年, E.F.Codd 提出了 OLAP 概念,认为 OLTP 已不
       能满足终端用户对数据库查询分析的需要, SQL 对大型数据库进
       行的简单查询也不能满足终端用户分析的要求。用户的决策分析
       需要对关系数据库进行大量计算才能得到结果,而查询的结果并
       不能满足决策者提出的需求。因此, E.F.Codd 提出了多维数据
       库和多维分析的概念,即 OLAP 。
          OLTP 数据                     OLAP 数据
              原始数据                     导出数据
          细节性数据                        综合性和提炼性数据

                 当前值数据                              历史数据
                     可更新                            不可更新,但周期性
      刷新
      一次处理的数据量小                                     一次处理的数据量大

      面向应用,事务驱动                                     面向分析,分析驱动
3   Copyright © 2005, Oracle. All rights reserved.
相关基本概念
     1. 维:是人们观察数据的特定角度,是考虑问题时的一
      类属性,属性集合构成一个维 ( 时间维、地理维等 ) 。
     2. 维的层:人们观察数据的某个特定角度 ( 即某个维 )
      还可以存在细节程度不同的各个描述方面 ( 时间维:日
      期、月份、季度、年 ) 。
     3. 维的成员:维的一个取值。是数据项在某维中位置的
      描述。 (“ 某年某月某日”是在时间维上位置的描述 )
     4. 维的分层:维层次的组合(如年月日,年季月日)
     5. 数据单元 ( 单元格 ) :多维数组的取值。 (2000 年 1
      月,上海,笔记本电脑, $100000)



4   Copyright © 2005, Oracle. All rights reserved.
OLAP 分类


                                                     OLAP



                   按照存储方式                                          按照处理地点



        ROLAP MOLAP HOLAP                                   Server OLAP   Client OLAP




5   Copyright © 2005, Oracle. All rights reserved.
ROLAP / MOLAP



    定义 :
    ROLAP = 基于关系的 OLAP
    MOLAP = 基于多维的 OLAP



6   Copyright © 2005, Oracle. All rights reserved.
OLTP 、 ROLAP 与 MOLAP 模式




7   Copyright © 2005, Oracle. All rights reserved.
ROLAP 的星型模式 (Star Schema)
                                                                     Market Table
               Period Table
                                                                      Market_id
                Time_id
                                                     Sales Table     Market_Desc
                Period_Desc
                                                                       District
                Quarter
                                                                       Region
                                                      Time_id
                Year
                                                     Product_id    quot;Dimension Tablequot;
          quot;Dimension Tablequot;
                                                     Market_id
                                                     Scenario
                Product Table
                                                      Dollars
                 Product_id
                                                      Units
                Product_Desc                                           Scenario Table
                                                     Discount%
                                                                         Scenario
                Brand

                Size                             quot;Fact Tablequot;          Actual

          quot;Dimension Tablequot;                                            Profit

     事实表:用来存储事实的度量值和各个维的码值。 Budget Tablequot;
                           quot;Dimension
    维   表:用来存放维的元数据(维的层次、成员类别等描述信息
      )。
8   Copyright © 2005, Oracle. All rights reserved.
MOLAP 的 多维立方体 (Multicube)




9   Copyright © 2005, Oracle. All rights reserved.
ROLAP 与 MOLAP 比较
 MOLAP 优势                                            MOLAP 缺点
        –    性能好、响应速度快                                  –   增加系统复杂度
        –    专为 OLAP 所设计                                –   需要进行预计算,可能导致
                                                            数据爆炸
        –    支持高性能的决策支持
             计算
              复杂的跨维计算
              多用户的读写操作




10   Copyright © 2005, Oracle. All rights reserved.
OLAP 发展

 从联机分析处理到联机分析挖掘 (OLAM/OLAP 挖掘 )

 ROLAP 与 MOLAP 的结合




11   Copyright © 2005, Oracle. All rights reserved.
12   Copyright © 2005, Oracle. All rights reserved.
Oracle 对数据仓库的理解
          数据仓库是一个过程,而不是一个产品 。

                                                           决策
                                                      使用

                            获取                             知识
                                         数据


                                          管理               信息
      数据仓库:
      对来自不同的数据源的大量杂乱的信息进行统一处理
      及管理,通过灵活的展现方法从中提炼出有规律的、                              数据
      可重复使用的知识来帮助决策支持,并将可以重复使
      用的知识转化为企业的核心竞争力。

13   Copyright © 2005, Oracle. All rights reserved.
传统的数据仓库解决方案

     Web Site                                           OLAP         Reporting      Portal



        ERP                                            Brand C      Ad-Hoc Query



     Legacy                                           Data Mining     Analysis

                              RDBMS

      Brand A                 Brand B                  Brand D       Brand E       Brand F



14   Copyright © 2005, Oracle. All rights reserved.
传统的数据仓库解决方案

                                    多种软件组成
     Web Site                                           OLAP         Reporting     Portal

                                    非集成的方案
        ERP                                                         Ad-Hoc Query

                                        凌乱的平台
     Legacy                                           Data Mining     Analysis

                                技术、接口复杂
                              RDBMS


                                数据迁移时间长
15   Copyright © 2005, Oracle. All rights reserved.
Oracle 商业智能分析应用
     -实现战略企业管理
                                                                   • 情景测试
                                         Oracle Balanced           • 战略目标建立
                                            Scorecard              • 记分卡
      Oracle BI Beans /                                            • 预测
     Global Consolidation                         建立目标
           •System
             合并报表                                                                   • 收入
             • 管理                                                                 Oracle ABM
                                                                                   • 资源




                                                                          建
             • 法律和法定             告                                                  • 约束条件




                                                                          模
             • 财务                                                                   • 利润
                               报


                                                    共享
                                                Oracle 9i/10g
                                                       信息
                               分




            • 收益率                                                                   • 财务规划




                                                                          划
                                 析




            • 差异                                                                    • 资源分配




                                                                          规
            • 效益                                                                    • 预算
     Oracle • 偏差 Business
            Daily
     Oracle Daily Business                                                    Oracle•Enterprise
                                                                                      要求
     Intelligence / Financial                         监控                         Planning &
      Analyzer / Discovery • 绩效度量                                                Budgeting
                                 • 效率和利用                Oracle ERP /
                                 • 基准                 Sales / Marketing

16   Copyright © 2005, Oracle. All rights reserved.
Oracle BI 产品定位
      应用
                                                           高级的分析、计划



                             Oracle            Oracle
      工具                     Reports         Discoverer

                                                      Business Intelligence Beans &
                                                              JDeveloper

                                             OLAP Services - Java OLAP API

     应用程序接口                          SQL OLAP

                            静态报表               特殊报表                 分析           预测分析


                                                        分析强度


17   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP
              –     OLAP 选件
              –     OLAP 术语
              –     ROLAP 和 MOLAP
              –     OLAP 详细技术
              –     OLAP 访问方式




18   Copyright © 2005, Oracle. All rights reserved.
Oracle 数据仓库平台
     完整集成的服务器



                                                         ETL


                                                        OLAP


                                                      Data Mining




19   Copyright © 2005, Oracle. All rights reserved.
什么是 OLAP 选项 ?

     OLAP 选项提供了一种执行分析性计算的能力
     ,这种能力已超越普通 SQL 所具备的功能 .

     如果安装了 OLAP 选项 , 就可以同时对关系型
     数据类型和多维数据类型执行计算




20   Copyright © 2005, Oracle. All rights reserved.
什么是 OLAP 选项 ?

     包括 :
           一个强大的 SQL 计算引擎
           一个强大的多维计算引擎
           多维数据的存储和检索
           面向 SQL 、 PL/SQL 和 Java 程序的 API
           面向多维数据的数据操作语言 (DML)
           能够访问多维数据的 SQL




21   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
        即席查询工具已经可以实现旋转、下钻和累计
         汇总等功能,我们是否还需要 OLAP 引擎 ?




22   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
        使用 SQL 工具,用户能够:
        旋转数据的视图
        按照层次( hierarchy )下钻和上钻
        创建简单的计算




23   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
        但是用户不能方便地:
        发现哪些顾客本周购买了产品‘ A’ ,而上周却
         没有购买
        在不同的级别 (level) ,分析 2 张事实表中的数
         据 ( 如按日分析实际销售 , 按月分析预算 )
        生成数据 ( 模型 , 预测 , 分配 )




24   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
                                               District                           Product
                                                          Boston
                                                   New York
                                                                                  Tents
                                             Philadelphia

查询实例:
                                                                                  Canoes
从费城( Philadelphia )
销售额最大的产品中(上
                                                                                  Racquets
个季度中,销售额至少达
到 $150K ),选出利润率
                                                                                  Sportswear
最高的前 2 位产品
                                                                                  Footwear




                                                            Q1     Q2   Q3   Q4

                                                                    Time

25   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
                                               District                           Product
                                                          Boston
                                                   New York
                                                                                  Tents
                                             Philadelphia

查询实例:
                                                                                  Canoes
    Limit Time to last 1
                                                                                  Racquets


                                                                                  Sportswear



                                                                                  Footwear




                                                            Q1     Q2   Q3   Q4

                                                                    Time

26   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
                                               District                           Product
                                                          Boston
                                                    New York
                                                                                  Tents
                                             Philadelphia

查询实例:
                                                                                  Canoes
    Limit Time to last 1
    Limit District to                                                            Racquets
     ‘Philadelphia’
                                                                                  Sportswear



                                                                                  Footwear




                                                             Q1    Q2   Q3   Q4

                                                                    Time

27   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
                                               District                           Product
                                                          Boston
                                                    New York
                                                                                  Tents
                                             Philadelphia

查询实例:
                                                                                  Canoes
    Limit Time to last 1
    Limit District to                                                            Racquets
     ‘Philadelphia’
    Limit Product to Sales                                                       Sportswear

     > 150,000
                                                                                  Footwear




                                                             Q1    Q2   Q3   Q4

                                                                    Time

28   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
                                               District                           Product
                                                          Boston
                                                    New York
                                                                                  Tents
                                             Philadelphia

查询实例:
                                                                                  Canoes
    Limit Time to last 1
    Limit District to                                                            Racquets
     ‘Philadelphia’
    Limit Product to Sales                                                       Sportswear

     > 150,000
    Limit Product keep                                                           Footwear

     Top 2 BasedOn Profit
                                                             Q1    Q2   Q3   Q4

                                                                    Time

29   Copyright © 2005, Oracle. All rights reserved.
OLAP Server
       内嵌函数 (Built-In Functions) 范
       例
        数值 / 时间序列函数                                   财务函数
        Average                                       Depreciation
        Cumulative Sums                               Growth Rate
        Lag/Lead                                      Net Present Value
        Variance                                      Internal Rate of Return
        Moving Average/Total
                                                      其他函数
        Smallest/Largest
                                                      Forecasting
        Standard Deviation
                                                      Regression
        Total


      … 或者创建自定义函数

30   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP 选项的发展历史


      随着技术发展不断进步
                  Express – 1970s – MDS
                  Express MDB – 1980s
                  Express Server – 1990s – Oracle
                  OLAP Option … 现在集成在 Oracle 的数据库中




31   Copyright © 2005, Oracle. All rights reserved.
OLAP 服务器
             集成的服务器技术和安全模式
             单点安全管理
             充分利用 Oracle 的并行技术和分区技术
             通过 SQL 进行访问

                         PRODUCT    REGION   MONTH SALES               PRODUCT    REGION   MONTH SALES
             RECORD #1     FILM      EAST    Dec-93  240   RECORD #1     FILM      EAST    Dec-93  240
             RECORD #2    LENSES     WEST    Jan-94  250   RECORD #2    LENSES     WEST    Jan-94  250
             RECORD #3   CAMERAS   CENTRAL   Feb-94  690   RECORD #3   CAMERAS   CENTRAL   Feb-94  690
             RECORD #4     FILM      WEST    Mar-94  425   RECORD #4     FILM      WEST    Mar-94  425
             RECORD #5    LENSES     EAST    Apr-94  300   RECORD #5    LENSES     EAST    Apr-94  300
             RECORD #6     FILM      WEST    May-94  500   RECORD #6     FILM      WEST    May-94  500
             RECORD #7   CAMERAS   CENTRAL   Jun-94  125   RECORD #7   CAMERAS   CENTRAL   Jun-94  125
             RECORD #8    LENSES     WEST     Jul-94 400   RECORD #8    LENSES     WEST     Jul-94 400
             RECORD #9     FILM      EAST    Aug-94  800   RECORD #9     FILM      EAST    Aug-94  800




                    Tables, Views, Dimensions                                                            Analytic Workspace

                                                                                 Oracle Database



32   Copyright © 2005, Oracle. All rights reserved.
OLAP 服务器
              分析工作区( Analytic Workspace )
              同 Express 功能类似
                                        –           Express 程序无需改动就可以在 AW 中运行
                                        –           完善的分析功能
                                        –           强大而细致的 What-if 、预测 分析
                         PRODUCT    REGION   MONTH SALES               PRODUCT    REGION   MONTH SALES
             RECORD #1     FILM      EAST    Dec-93  240   RECORD #1     FILM      EAST    Dec-93  240
             RECORD #2    LENSES     WEST    Jan-94  250   RECORD #2    LENSES     WEST    Jan-94  250
             RECORD #3   CAMERAS   CENTRAL   Feb-94  690   RECORD #3   CAMERAS   CENTRAL   Feb-94  690
             RECORD #4     FILM      WEST    Mar-94  425   RECORD #4     FILM      WEST    Mar-94  425
             RECORD #5    LENSES     EAST    Apr-94  300   RECORD #5    LENSES     EAST    Apr-94  300
             RECORD #6     FILM      WEST    May-94  500   RECORD #6     FILM      WEST    May-94  500
             RECORD #7   CAMERAS   CENTRAL   Jun-94  125   RECORD #7   CAMERAS   CENTRAL   Jun-94  125
             RECORD #8    LENSES     WEST     Jul-94 400   RECORD #8    LENSES     WEST     Jul-94 400
             RECORD #9     FILM      EAST    Aug-94  800   RECORD #9     FILM      EAST    Aug-94  800




                    Tables, Views, Dimensions                                                            Analytic Workspace

                                                                                 Oracle Database



33   Copyright © 2005, Oracle. All rights reserved.
OLAP 服务器
            能够访问关系表和多维数据
            提供建立“立方体”的选项

                                                                                 OLAP Option
                                                                                                Query        Multi Dimensional
                          SQL Generator
                                                                                              Processor            Engine

                         PRODUCT    REGION   MONTH SALES               PRODUCT    REGION   MONTH SALES
             RECORD #1     FILM      EAST    Dec-93  240   RECORD #1     FILM      EAST    Dec-93  240
             RECORD #2    LENSES     WEST    Jan-94  250   RECORD #2    LENSES     WEST    Jan-94  250
             RECORD #3   CAMERAS   CENTRAL   Feb-94  690   RECORD #3   CAMERAS   CENTRAL   Feb-94  690
             RECORD #4     FILM      WEST    Mar-94  425   RECORD #4     FILM      WEST    Mar-94  425
             RECORD #5    LENSES     EAST    Apr-94  300   RECORD #5    LENSES     EAST    Apr-94  300
             RECORD #6     FILM      WEST    May-94  500   RECORD #6     FILM      WEST    May-94  500
             RECORD #7   CAMERAS   CENTRAL   Jun-94  125   RECORD #7   CAMERAS   CENTRAL   Jun-94  125
             RECORD #8    LENSES     WEST     Jul-94 400   RECORD #8    LENSES     WEST     Jul-94 400
             RECORD #9     FILM      EAST    Aug-94  800   RECORD #9     FILM      EAST    Aug-94  800




                    Tables, Views, Dimensions                                                             Analytic Workspace

                                                                                 Oracle Database



34   Copyright © 2005, Oracle. All rights reserved.
OLAP 服务器
           – 开放的访问机制
                                                           Any SQL Application




                                                                                                                  View
                                                                                                             Table Function

                         PRODUCT    REGION   MONTH SALES               PRODUCT    REGION   MONTH SALES
             RECORD #1     FILM      EAST    Dec-93  240   RECORD #1     FILM      EAST    Dec-93  240
             RECORD #2    LENSES     WEST    Jan-94  250   RECORD #2    LENSES     WEST    Jan-94  250
             RECORD #3   CAMERAS   CENTRAL   Feb-94  690   RECORD #3   CAMERAS   CENTRAL   Feb-94  690
             RECORD #4     FILM      WEST    Mar-94  425   RECORD #4     FILM      WEST    Mar-94  425
             RECORD #5    LENSES     EAST    Apr-94  300   RECORD #5    LENSES     EAST    Apr-94  300
             RECORD #6     FILM      WEST    May-94  500   RECORD #6     FILM      WEST    May-94  500
             RECORD #7   CAMERAS   CENTRAL   Jun-94  125   RECORD #7   CAMERAS   CENTRAL   Jun-94  125
             RECORD #8    LENSES     WEST     Jul-94 400   RECORD #8    LENSES     WEST     Jul-94 400
             RECORD #9     FILM      EAST    Aug-94  800   RECORD #9     FILM      EAST    Aug-94  800




                    Tables, Views, Dimensions                                                            Analytic Workspace

                                                                                 Oracle Database




35   Copyright © 2005, Oracle. All rights reserved.
OLAP 服务器
                 – Java OLAP API
                                                           Business Intelligence Beans

                                                                                    OLAP Option
                                                                                       Java OLAP API

                                                                                                   Query        Multi Dimensional
                          SQL Generator
                                                                                                 Processor            Engine

                         PRODUCT    REGION   MONTH SALES                  PRODUCT    REGION   MONTH SALES
             RECORD #1     FILM      EAST    Dec-93  240      RECORD #1     FILM      EAST    Dec-93  240
             RECORD #2    LENSES     WEST    Jan-94  250      RECORD #2    LENSES     WEST    Jan-94  250
             RECORD #3   CAMERAS   CENTRAL   Feb-94  690      RECORD #3   CAMERAS   CENTRAL   Feb-94  690
             RECORD #4     FILM      WEST    Mar-94  425      RECORD #4     FILM      WEST    Mar-94  425
             RECORD #5    LENSES     EAST    Apr-94  300      RECORD #5    LENSES     EAST    Apr-94  300
             RECORD #6     FILM      WEST    May-94  500      RECORD #6     FILM      WEST    May-94  500
             RECORD #7   CAMERAS   CENTRAL   Jun-94  125      RECORD #7   CAMERAS   CENTRAL   Jun-94  125
             RECORD #8    LENSES     WEST     Jul-94 400      RECORD #8    LENSES     WEST     Jul-94 400
             RECORD #9     FILM      EAST    Aug-94  800      RECORD #9     FILM      EAST    Aug-94  800




                    Tables, Views, Dimensions                                                                Analytic Workspace

                                                                                    Oracle Database




36   Copyright © 2005, Oracle. All rights reserved.
OLAP 的相关信息

      版本
                   RDBMS/OLAP – Oracle 9i ( 9.2.0.1 – 9.2.0.6 )
                                                – Oracle 10g ( 10.1.0.2 – 10.1.0.4 )
                   AW Manager – 10.1.0.4
                   Discoverer – Drake
                   OWB - Paris
      http://metalink.oracle.com 提供 RDBMS 和 OLAP patch
           的下载
      http://www.oracle.com 提供 AW Manager 的下载


37   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP
              –     OLAP 选件
              –     OLAP 术语
              –     ROLAP 和 MOLAP
              –     OLAP 详细技术
              –     OLAP 访问方式




38   Copyright © 2005, Oracle. All rights reserved.
术语
     o OLAP – 联机分析处理 ( 同在线事务处理 OLTP 相对应 )

     o ROLAP – 基于关系型数据库的 OLAP :在关系型数据
         上建立多维视图

     o MOLAP – 基于多维数据库的 OLAP: 数据以多维度的方
         式存储在分析工作区( Analytic Workspace )中

     o Analytic Workspace (AW) – 多维方案
         (multidimensional schema) ,以 BLOB 的形式存储在
         Oracle 数据库中 , 包含维度、变量、层次、程序等对象


39   Copyright © 2005, Oracle. All rights reserved.
术语
     o 维度 (Dimension) – 一个用来给数据分类的结构 ( 如
        Time, Geography, Product)

     o 层次 ( Hierarchy ) – 在维度中预定义的不同级别,用来
        实现汇总和钻取功能

     o 度量 ( Measure ) – 用来存储(或计算)多维数据;类
        似于实事列 (fact column)

     o 公式 (Formula) – 在 AW 中一个经计算的度量

     o 立方体 (Cube) – 由具有相同维度的度量组成的逻辑结构

40   Copyright © 2005, Oracle. All rights reserved.
术语
             o CWM 元数据 – 用来描述数据和其他对象的数
                    据。 OLAP catalog 就是一种元数据,以多维数
                    据的术语描述数据,如立方体、度量、维度和属
                    性。

             o DML – 数据操作语言:
                    Analytic Workspaces 所使用的面向多维数据的
                    编程语言




41   Copyright © 2005, Oracle. All rights reserved.
术语
             o OLAPI – OLAP API, BI Beans 通过 OLAP
                    API 同 AW 进行通讯。由 OLAPI 生成 SQL 语
                    句

             o AW View – 一种视图,使 SQL 语句能够在
                    AW 中访问多维对象

             o 物化视图 (Materialized view) – 一种预计
                    算的关系型汇总表,由汇总数据组成,用来提
                    高 ROLAP 的性能。




42   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP
              –     OLAP 选件
              –     OLAP 术语
              –     ROLAP 和 MOLAP
              –     OLAP 详细技术
              –     OLAP 访问方式




43   Copyright © 2005, Oracle. All rights reserved.
问 题
           • OLAP 按照存储方式可以分为几类?
            ROLAP 、 MOLAP 、 HOLAP


           • AW 的中、英文全称是什么?
            分析工作区、 Analytic Workspace




44   Copyright © 2005, Oracle. All rights reserved.
ROLAP
      Select a ROLAP implementation when the analytic
      requirements of the business are met by the
      capabilities of SQL.

            Easy to implement

            Relational tables with cubes defined by OLAP metadata

            Beans access via the OLAP API generated SQL

            Materialized Views for better performance


45   Copyright © 2005, Oracle. All rights reserved.
MOLAP
      Select a MOLAP implementation when the analytic
      requirements of the business need the extended
      analytic, forecasting and planning functionality
      provided by the Analytic Workspace.


       Can use OLAP DML to add analytic capability to the AW

       AWs are stored in relational tables

       AW can be enabled for use with BI Beans or other SQL clients



46   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP
              –     OLAP 选件
              –     OLAP 术语
              –     ROLAP 和 MOLAP
              –     OLAP 详细技术
              –     OLAP 访问方式




47   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP 的组件架构

                                             Oracle Database
                                                                            JDBC


                        Oracle Call Interface                             OLAP API


               Relational Technology            Object Technology            OLAP Technology
                                                                             Multidimensional
                     SQL Engine                  Table Functions
                                                                                  Engine



                                                      Storage
                                                      OLAP Catalog


                                    Relational Data
                                                                   Multidimensional
                                                                         Data



48   Copyright © 2005, Oracle. All rights reserved.
元数据 /Metadata



49   Copyright © 2005, Oracle. All rights reserved.
元数据 -- Metadata
         元数据是什么
           – 逻辑的多维数据模型
           – 同关系数据库对象的映射关系
           – 同 Analytic Workspace 对象的映射关系
         为什么使用元数据
           – 供 OLAP API 和 Oracle 工具使用
         怎样使用元数据
           – 通过 Oracle Enterprise Manager
           – 通过 Oracle Warehouse Builder
           – 通过 PL/SQL API
         元数据存储在哪里
           – OLAP Catalog

50   Copyright © 2005, Oracle. All rights reserved.
元数据 -- Metadata
     描述逻辑数据模型
           –   如 dimension, level, hierarchy, attribute.

              逻辑模型中的对象反映的是人们对业务的认识。这样
               的模型带给最终用户简单易用的体验。

     将逻辑数据模型映射到物理实现
           –   如将逻辑对象映射到表或视图的列 .

              把应用程序的数据模型同物理实现隔离开,可以构建
               更稳固的应用程序。


51   Copyright © 2005, Oracle. All rights reserved.
元数据 -- Metadata
     整个元数据资料库 (Metadata Repository) 统称为
      OLAP Catalog
     OLAP Catalog 由下列表组成:
                   CWM 1 关系表
                   CWM 2 关系表
                   AW 字典
                   Oracle 数据字典




52   Copyright © 2005, Oracle. All rights reserved.
元数据 -- Metadata


      Oracle 提供了一些工具和 API 来定义元数据。

      其中一个重要的工具是 Enterprise Manager.
      这是一个易用的数据库管理工具,
      能够定义星型模型或雪花模型的
      OLAP 元数据


                                                      Oem.lnk
53   Copyright © 2005, Oracle. All rights reserved.
对象类型 /Object Types



54   Copyright © 2005, Oracle. All rights reserved.
OLAP 对象类型


            • 抽象数据类型 -- Abstract
            data types (ADTs)
            • 表函数技术 -- Table function



55   Copyright © 2005, Oracle. All rights reserved.
抽象数据类型实例 (ADT) ...
     1. 创建 ADT 记录对象                              create type time_type_row as object (
                                                   month         varchar(10),
                                                   month_label   varchar(6),
                                                   quarter       varchar(3),
                                                   quarter_label varchar(8),
                                                   year          varchar(3),
                                                   year_label    varchar(5));




     2. 创建表对象                                     create type time_type_table
                                                    as table of time_type_row ;




     抽象数据类型提供了一种方法,把非关系型数据映射到关
              系型的数据格式

56   Copyright © 2005, Oracle. All rights reserved.
表函数技术

                         表函数技术可以用来
                        实现非关系型数据源和数据库
                          之间的通信。




57   Copyright © 2005, Oracle. All rights reserved.
表函数技术

       • 表函数能够将非关系型数据映射为关系
         型数据格式。
       • 表函数能够将来自于非关系型数据源的
         数据物理地转化为关系型视图。
       • OLAP_TABLE 表函数生成 DML ,这
         样就能与 AW 进行交互。

58   Copyright © 2005, Oracle. All rights reserved.
表函数技术
     实例 …
                          将表函数的定义嵌在关系型视图的定义中:
           create or replace view time_view as
             select *
             from table(OLAP_TABLE(‘production.sales DURATION query',
                            'TIME_TYPE_TABLE',
                            'limit time to levelrel.time ''month''',
                            'DIMENSION month FROM time
                             MEASURE month_label FROM name.time
                             MEASURE quarter FROM time.qtr
                             MEASURE quarter_label FROM time.qtr.name
                             MEASURE year FROM time.year
                             MEASURE year_label FROM time.year.name'
                             ));




59   Copyright © 2005, Oracle. All rights reserved.
表函数技术
     实例…
         在 SELECT 语句中,使用表函数:
         SQL> select
          time_id, channel_id, product_id, customer_id, sales,
          custmeas_1 MONTH_AGO, custmeas_2 CHG, custmeas_3 PCT_CHG
          from table(OLAP_TABLE('production.sales DURATION query',
                         'SALES_TYPE_TABLE',
                         ‘FORECAST_SALES',
                         'DIMENSION time_id FROM time
                          DIMENSION channel_id FROM channel
                          DIMENSION product_id FROM product
                          DIMENSION customer_id FROM customer
                          MEASURE sales FROM sales
                          MEASURE custmeas_1 from custmeas_1

                                    MEASURE custmeas_2 from custmeas_2

                           MEASURE custmeas_3 from custmeas_3'))
           where time_level = ('MONTH') and channel_id = '5'
           and product_id = '70' and customer_id in ('114')
           order by customer_id, time_id;
60   Copyright © 2005, Oracle. All rights reserved.
表函数技术
                                       表函数的运行机制
                                              APPLICATION


                                                            通过 OCI 或 JDBC
                            SELECT 语句                          返回数据


                                          RELATIONAL ENGINE


                          分析 Select 列表和
                           WHERE 子句                         以关系格式返回数据



                                              OLAP_TABLE



                             OLAP DML                       以多维格式返回数据



                    汇总和计算              MULTIDIMENSIONAL ENGINE


                                                                            Analytic Workspace



61   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP
              –     OLAP 选件
              –     OLAP 术语
              –     ROLAP 和 MOLAP
              –     OLAP 详细技术
              –     OLAP 访问方式




62   Copyright © 2005, Oracle. All rights reserved.
Oracle OLAP – 多种访问方式

                   OLAP API                       Generic SQL                  ‘OLAP aware’ SQL
                   Application                    Application                     Application

            OLAP API                      OCI or JDBC                                       OCI or JDBC

Select … from                           Select … from
                 SQL Generator                                      Select … from
View/table                              View/table
                                                                    view


                                                  RDBMS View



                                                 Table Function
                                                                            Select … from
                                                                            OLAP_TABLE       •DBMS_AW.EXECUTE
                                                                                             •DBMS_AW.INTERP
                                                                                             •DBMS_AW.INTERPCLOB




                                          Relational     Multidimensional



 63   Copyright © 2005, Oracle. All rights reserved.
开放访问的特点
        OLAP 满足多种需求
       企业对报表和应用程序的需求可能会各不相同。

              有些用户只需要一个简单的报表工具,如
               HTML DB 。
              有些用户需要功能更复杂的电子表格工具,如
               Excel add-in 或 Discoverer Plus OLAP 。


              还有一些用户需要通过 BI Beans ,构建专用的
               分析应用。

64   Copyright © 2005, Oracle. All rights reserved.
前端工具的种类
                                              8. 任何 SQL 接口
                                              的查询工具
     7. 用户自定义                                                       1. 简单的报表工具,可以执
     的应用程序                                                          行预定义的 SQL 语句,无须
                                                                    了解 OLAP 。




6. 电子表格工具                                               DW            2. 支持 OLAP 的查
                                                         ETL
                                                                      询工具,能够通过
                                                       OLAP
                                                                      SQL 。
                                                      Data Mining




     5. 支持 OLAP 的                                                   3. 支持 多维数据对象
     应用程序构建工                                                        和 OLAP 的查询工具
     具                                          4. 能够以多种样式          ,能够通过 SQL 。
                                                严格定义报表格式
                                                的工具。



65   Copyright © 2005, Oracle. All rights reserved.
Oracle 前端工具
                                              8. 任何 SQL
                                              接口的查询工
                                              具
     7. 用户自定义的                                                       1. 简单的报表工具,可以执
                                              SQL, PL/SQL
     应用程序                                                            行预定义的 SQL 语句,无须
     OLAP Java API                                                   了解 OLAP 。
                                                                     HTML DB


6. 电子表格工具                                               DW               2. 支持 OLAP 的查
Oracle Excel Add-in                                      ETL
                                                                         询工具,能够通过
                                                       OLAP
                                                                         SQL 。 Discoverer
                                                      Data Mining
                                                                         for OLAP


     5. 支持 OLAP 的                                                   3. 支持多维数据对象和
     应用程序构建工                                                        OLAP 的查询工具,能够通
     具                                          4. 能够以多种样式严         过 SQL 。
     BI Beans                                   格定义报表格式的工           Discoverer for OLAP Plus
                                                具。
                                                Reports


66   Copyright © 2005, Oracle. All rights reserved.
多维数据访问的实例


          •      HTML DB – 简单的报表工具,无须了解
                 OLAP 。

          •      新 ! Discoverer Plus OLAP – 一个非常有用
                 的 OLAP 工具,支持 OLAP 查询的构建和多维数据
                 查询结果的展示。
          •      BI Beans – 支持 OLAP 的组件,可以用来快速
                 开发客户自定义应用程序。




67   Copyright © 2005, Oracle. All rights reserved.
Oracle HTML DB




68   Copyright © 2005, Oracle. All rights reserved.
Oracle HTML DB

               建立交互式的 WEB 应用
           易用性和高效性的结合,同时具有所有
          Oracle 数据库的特点 : 可用性、扩展性、安全
          性
               快速开发分析性的应用和报表
               无需              OLAP 支持的基础
               需要使用者具有 SQL 使用的经验


69   Copyright © 2005, Oracle. All rights reserved.
Oracle HTML DB
                                                     访问结构


                                              HTML Database




                                                      Relational Views



                                                       OLAP_TABLE




                                        Relational    Multidimensional




70   Copyright © 2005, Oracle. All rights reserved.
当前的 HTML DB web 报表包含了
在 Oracle AW 内执行的计算结果

让我们继续深入观看
此 SQL 代码由
报表建立者输入
Oracle HTML DB

        报表内的数据来源于 AW

        HTML DB 成为简单的报表工具而无需 OLAP 的知识
         , SQL 命令的执行方式极为简单
        报表制作无需 AW 的知识 . 只需要知道如何针对
         view 书写 SQL 语句
        HTML DB 的价值就是极大的提高访问 AW 内部数据
         的简单性




74   Copyright © 2005, Oracle. All rights reserved.
Discoverer Plus OLAP




75   Copyright © 2005, Oracle. All rights reserved.
Discoverer Plus OLAP

                  OLAP 工具
                          支持多维数据
                          提供例外分析和基于排名的选择
                          用户不需要 SQL 经验
                          由 Oracle BI Beans 开发



76   Copyright © 2005, Oracle. All rights reserved.
Discoverer Plus OLAP
                                                  访问结构
                                             Discoverer Plus OLAP




                                                      OLAP API




                                                          Relational Views



                                                           OLAP_TABLE




                                          Relational      Multidimensional


77   Copyright © 2005, Oracle. All rights reserved.
使用 Discoverer Plus 导
向工具建立报表
第一步是设计报表的规
划和图形组件
下一步 , 选择报表中要
包含的业务内容

这就是 BI Beans Query
Builder!
注意此导向工具是与 Oracle
OLAP Server 直接匹配的 , 所
以一旦你选中了一个 measure,
与此相关的所有 dimension 都
会自动被选中 .
改变字段的顺序来满足你的要求
指定维度层次 , 并加入查询条
件
点击 Finish 来查看报表 , 并根据
你的需求进行客户化
Discoverer Plus OLAP
       •     Discoverer Plus OLAP 完全支持多维数据模型,无
             论该模型是 ROLAP 方式或 MOLAP 方式。

       •     用户界面支持对多维数据进行操作。
       •     能够轻而易举地建立例外和排名报表。
       •     制作报表的人员无须具有 AW ,或 SQL 的知识。




85   Copyright © 2005, Oracle. All rights reserved.
BI Beans




86   Copyright © 2005, Oracle. All rights reserved.
BI Beans

     • 为交互式分析应用构建组件
     • BI Beans 能够集成在任何的 Java 集成开发环境
       中 (IDE) ,但在 JDeveloper 中,可以达到最佳效
       果
     • 不需要 OLAP DML 编程经验




87   Copyright © 2005, Oracle. All rights reserved.
BI Beans
        BI Beans 可以在下列 Oracle 产品中使用
           :
        • Oracle Reports
        • Discoverer
        • Excel Add-in
        • Enterprise Planning and Budgeting




88   Copyright © 2005, Oracle. All rights reserved.
BI Beans 应用程序构架
                                              Forecasting Application

                         Query Builder Bean       Cross Tab Bean              Graphic Bean

                                                       Data Beans


                                                      OLAP API




                                                          Relational Views



                                                           OLAP_TABLE




                                          Relational       Multidimensional


89   Copyright © 2005, Oracle. All rights reserved.
使用 JDeveloper 和 BI Beans
建立一个客户化的分析应用
当前的客户应用同时包含了
BI Beans 组件和客户化的
Java 代码 .
BI Beans
       •     交互式的客户化分析应用。

       •     可以构建一个“胖”客户端或“瘦”客户端。
       •     制作的报表人员需要具备 OLAP DML 和 Java 编
             程的相关知识。




93   Copyright © 2005, Oracle. All rights reserved.
相关工具介
                                        绍




94   Copyright © 2005, Oracle. All rights reserved.
Oracle 工具
     使开发变得更为简单

            •      Warehouse Builder
            •      Enterprise Manager
            •      Analytic Workspace Manager
            •      BI Beans

95   Copyright © 2005, Oracle. All rights reserved.
Warehouse Builder
           • 提供设计环境
           • 保存设计规范
           • 将设计部署,以建立所有对象的空结构
           • 加载数据
           • 能够指定随后的数据加载和数据仓库维护的
             方法


96   Copyright © 2005, Oracle. All rights reserved.
Enterprise Manager
           • Oracle Enterprise Management 工具能够
             定义并维护星型模型的元数据。




97   Copyright © 2005, Oracle. All rights reserved.
AW Manager
        • 能够简单的根据现有的关系型模型,创建
          AW 。
        • 创建支持 OLAP 的所有对象。
        • 能够浏览 AW 中的对象。
        • 能够向 AW 添加 OLAP DML 代码。
        • 能够指定随后的数据加载和数据仓库维护的
          方法。


98   Copyright © 2005, Oracle. All rights reserved.
BI Beans
           • 提供设计环境。
           • 以 XML 格式存储设计规范。
           • 设计可以被部署到不同的应用服务器中。




99   Copyright © 2005, Oracle. All rights reserved.
使用
              Enterprise Manager
                       和
          Analytic Workspace Manager
                    来构建
                 OLAP 数据仓库


100   Copyright © 2005, Oracle. All rights reserved.
建立 OLAP 数据仓库的步骤
      利用 OEM
       把源数据转化成为星型模型 (Star Schema)
       定义星型模型的元数据 (metadata)
              < 完成这一步就得到了 ROLAP 模型 >
      利用 AWM
      6. 建立分析工作区 (Analytic Workspace, AW)
      7. 定义映射到视图的元数据 ( 如果使用 OLAP
         API)
              < 现在你得到了 MOLAP 模型 >




101   Copyright © 2005, Oracle. All rights reserved.
建立 OLAP 数据仓库的步骤




                    Step 1
                 创建星型模型
             (OWB 和运行 ETL)




102   Copyright © 2005, Oracle. All rights reserved.
建立 OLAP 数据仓库的步骤


                                                        OLAP
                                                       Catalog
                                  Step 2
                       定义 ROLAP 模型的元数据
                       (OWB 和 Oracle Enterprise
                             Manager)



                    Step 1
                 设计星型模型
             (OWB 和运行 ETL)




103   Copyright © 2005, Oracle. All rights reserved.
建立 OLAP 数据仓库的步骤


                                                         OLAP
                                                        Catalog
                                  Step 2
                       定义 ROLAP 模型的元数据
                       (OWB 和 Oracle Enterprise
                             Manager)



                    Step 1
                设计星型模型
             (OWB 和运行 ETL)

                                                                  Step 3
                                                            构造 MOLAP 模型
                                                       (OWB 和 Analytic Workspace
                                                              Manager)




104   Copyright © 2005, Oracle. All rights reserved.
建立 OLAP 数据仓库的步骤


                                                            OLAP
                                                           Catalog
                               Step 2
                    定义 ROLAP 模型的元数据
                    (OWB 和 Oracle Enterprise
                          Manager)



                Step 1
            设计星型模型
         (OWB 和运行 ETL)


                                                                Step 3
                                                            构造 MOLAP 模型
                                                       (OWB 和 Analytic Workspace              Step 4
                                                              Manager)                       汇总数据
                                                                                   (Analytic Workspace Manager)


105   Copyright © 2005, Oracle. All rights reserved.
练习环境介绍
OLAP Server
        –Oracle  10g 10.1.04 EE
        http://www.oracle.com/technology/software/products/
        –Oracle 10.1.04 patch set
        –http://metalink.oracle.com

OLAP Client
        –Oracle 10g Client
        http://www.oracle.com/technology/software/products/
        –Analytic Workspace Manager 10.1.0.4
        http://www.oracle.com/technology/products/bi/olap/olap.html
        –Oracle BI Spreadsheet Add-In
        http://www.oracle.com/technology/products/bi/spreadsheet_addin
      /index.html




106   Copyright © 2005, Oracle. All rights reserved.
ROLAP
      基于关系型结构,进行多维数据的表示和存储
      通过在事实表和维表间建立主 / 外键,生成星
       型和雪花模型
      通过 OLAP API ,执行 SQL 来访问模型和进
       行分析




107   Copyright © 2005, Oracle. All rights reserved.
星型模型示例
维( Dimension )

      创建维表
               –   级别关键字段,最低级别是主键
               –   描述属性字段,每个级别至少一个
               –   一般属性字段
               –   其他约束,如非空检查
      增加一个关系型维对象
               –   将逻辑级别名和关键字段做映射
               –   定义逻辑级别上的层次
               –   对逻辑级别和属性字段做 1 对 1 的映射
               –   定义雪花模型中的连接
      增加 CWM 元数据


109   Copyright © 2005, Oracle. All rights reserved.
事实表( Fact )

      对每个维建立外键
      至少一个度量字段
      适当建立索引




110   Copyright © 2005, Oracle. All rights reserved.
ROLAP
       如果通过执行 SQL 可以满足分析需要,则可
       以选择 ROLAP :

                     容易实施

                   通过 OLAP API 和 SQL 来访问

                   通过物化视图( Materialized View )来提高性能




111   Copyright © 2005, Oracle. All rights reserved.
D E M O N S T R A T I O N

                                        练习演示
                                         123

112   Copyright © 2005, Oracle. All rights reserved.
在维上建 MV

      提供物化的层次视图
      每个层次上建一个 MV


                      Region                                     Product

                             State

                                      City                  Sales
                                                                            Sales by
                                                        CREATE
                                                                           Brand, City
                                                                           and Month



                                                 Time


113   Copyright © 2005, Oracle. All rights reserved.
对维上的 MV 建索引

      在每个级别关键字段上建位图索引( Bitmap
       Index )

                                                           Bitmap index

                                                       A
                                                       B
                                                       C
                        rows
                                                              1   0




114   Copyright © 2005, Oracle. All rights reserved.
10g 新功能

      访问指导( Advisor )
               –   通过分析访问工作量来建议 MV
      分区变动跟踪和刷新
      dbms_mview 包
               –   tune_mview 可以使 MV 刷新更快




115   Copyright © 2005, Oracle. All rights reserved.
常见问题

      ROLAP 模型有 Bug
               –     dbms_odm 包
                      重复的对象和字段名
                      不正确的结构
               –   MV 生成脚本过大 ( 超过 64K)
               –   太多的分区
               –   临时表空间太少




116   Copyright © 2005, Oracle. All rights reserved.
问 题
            • 在 ROLAP 模式中,维表的主键应该建在
              哪个级别( LEVEL )上?
             最低级别上


            • 元数据资料库 (Metadata Repository) 统
              称为什么? OLAP 对象类型是哪两个?
             OLAP Catalog ,抽象数据类型
              ( Abstract data types) 和表函数( Table
              function )
117   Copyright © 2005, Oracle. All rights reserved.
软件
      服务器
               –   10.1.0.4
               –   Post-install
      客户端
               –   awm




118   Copyright © 2005, Oracle. All rights reserved.
MOLAP
      如果业务需要使用 AW 所提供的扩展分析、预
      测和计划功能时,就应该选择 MOLAP 的实现
      方法。
               能够通过使用 OLAP DML 来向 AW 加入分析功能

        AW 存储在关系型表中

           可以使用 BI Beans 或其它 SQL 客户端程序来访
          问 AW



119   Copyright © 2005, Oracle. All rights reserved.
分析工作区( Analytic
                            Workspace )

                 • Analytic Workspace 是一种多维数据
                   类型。
                 • 该数据类型包含了大量所存数据的描
                   述信息。




120   Copyright © 2005, Oracle. All rights reserved.
分析工作区( Analytic
                            Workspace )
               • 内嵌在 RDBMS 中的计算引擎,对 AW
                 中的数据进行操作
               • 可以使用 OLAP DML 对 AW 中的对
                 象和数据进行操作
               • OLAP_TABLE 表函数向 AW 发送
                 DML 命令
               • 从 AW 中获得的查询结果发送到
                 OLAP_TABLE


121   Copyright © 2005, Oracle. All rights reserved.
分析工作区( Analytic
                    While A
                            Workspace )
                     Do B
                    End

                    Program                               Other
                   source code                         information
                                                                                     OLAP
                                                                                     DML




                                                                          Data
               Hierarchy
                                           Formulas and              relationships
               definitions
                                             equations




             Definitions for logical                     Dimension             Measure
               groupings of data                            data                data

                  - CUBES -


122   Copyright © 2005, Oracle. All rights reserved.
9i 分析工作区 (Analytic Workspace)
      UID   SEQ
                         BLOB 对象

                                                        • AW 以二进制大
      123    1
                                                          对象 (BLOB)
                                                          的方式存储在标
                                                          准关系型表中。
                                                        • AW 可以跨越行
                                                          。


      123    2




123    Copyright © 2005, Oracle. All rights reserved.
124   Copyright © 2005, Oracle. All rights reserved.
分析工作区( Analytic
                            Workspace )
       可以使用 Oracle OLAP Worksheet* 工具来浏览
       Analytic Workspace 中的内容。
         -> aw attach global                           如果配置相
                                                       同,可以按
        -> listnames                                   照左边范例
        -> set colwidth 50;set lcolwidth 50;           输入相应的
        -> report channel                              命令。
        -> fulldsc channel
        -> fulldsc cost_chg_pp
        * 可以在          AW Manager 中获得 OLAP Worksheet 工具



                                                           Awm.ico
125   Copyright © 2005, Oracle. All rights reserved.
分析工作区( Analytic
                            Workspace )
         下列 Oracle 工具能够自动地 按照标准形式创建
         AW 和它的对象:


            Warehouse Builder

                    AW Manager

              DBMS_AWM APIs



126   Copyright © 2005, Oracle. All rights reserved.
将分析内容加入到 AW 中
                                               OLAP DML 编程




                                               可以使用 Oracle 工具来:
                                                       • 创建 Analytic Workspace
                                                       • 将对象加入 AW
                                                       • 加载数据

                                               通过使用 OLAP DML ,可以将客户
                                               化对象加入到 Analytic
                                               Workspace.




127   Copyright © 2005, Oracle. All rights reserved.
将分析内容加入到 AW 中
                                              OLAP DML 编程




           // This is an OLAP DML program called CREATE_CALCULATION_FORMULA

           // Name and define the formula object
           DEFINE PROFIT FORMULA DECIMAL <CHANNEL CUSTOMER PRODUCT TIME>

           // Give it a long description
           LD 'Profit as defined by Sales less Cost'

           // Provide the arithmetic calculation
           EQ sales - extended_cost

           // Call a program to create a measure using this formula
           call create_measure_from_formula('formula_name=PROFIT
           cube_name=UNITS_CUBE display_name=Profit')




128   Copyright © 2005, Oracle. All rights reserved.
AWM2 的特性

      映射维度
      存储
               –   压缩组合
               –   维度顺序
               –   分区
               –   规则
               –   预汇总
               –   缓存



129   Copyright © 2005, Oracle. All rights reserved.
D E M O N S T R A T I O N

                                        练习演示


130   Copyright © 2005, Oracle. All rights reserved.
AWM2 的特性

      映射维度
      存储
               –   压缩组合
               –   维度顺序
               –   分区
               –   规则
               –   预汇总
               –   缓存



133   Copyright © 2005, Oracle. All rights reserved.
压缩组合( Compressed
      Composite )
      一般的组合包括:
              –   所有的叶结点的值
              –   所有预计算的合计值
              –   所有合计值

      如果数据是稀疏的,那么
       很多合计可能只对一个值
       来做,也就是说很多合计
       的值是相同的。


134   Copyright © 2005, Oracle. All rights reserved.
压缩组合( Compressed
      Composite )
      自动压缩
      对重复值只存储一次
      减少所占磁盘和内存空间
      提高合计速度




135   Copyright © 2005, Oracle. All rights reserved.
何时使用压缩组合?

        使用压缩组合的条件
                 –    用 SUM 或 NOAGG 方法
                 –    数据稀疏
        时间维:
                 –    如果到月或更高级别,不使用
                 –    如果到日,可以使用
                 –    如果到周,可以试试




136   Copyright © 2005, Oracle. All rights reserved.
维度顺序
维度顺序
         对于压缩组合 :
                  –    密集维必须在压缩组合的维度前
                  –    压缩组合中的维度可任意排列


         对于正常组合 :
                  –    维度由大到小排列




138   Copyright © 2005, Oracle. All rights reserved.
分区
分区
        分区可以将立方体再分成更小的存储部分,每
         部分都有自己的组合

        控制组合和变量的大小
                 –    可以全部加载到内存中,这样计算会快

        可以并行地加载和计算数据

        分区所在级别以下各级会自动预计算


140   Copyright © 2005, Oracle. All rights reserved.
规则
规则

         压缩组合时,只有 SUM 和 NOAGG 方法可
          以使用

         非压缩组合时,可以用所有的计算方法

         可以选择层次进行计算




142   Copyright © 2005, Oracle. All rights reserved.
预汇总
预汇总

         如果是压缩组合,全部做预汇总

         否则选择级别做预汇总
                  –    基于以下规则 :
                         希望在哪个级别提高查询响应速度 ;
                         平衡每个级别下的“孩子”数;




144   Copyright © 2005, Oracle. All rights reserved.
缓存

        动态汇总的值可以记录在缓存中

        缓存的值不会随数据的改变而自动刷新

        适用于只读型应用




145   Copyright © 2005, Oracle. All rights reserved.
大数据量处理

      多种物理存储模式
      MULTI 访问方式
      分区
      并行
      RAC 和网格计算




146   Copyright © 2005, Oracle. All rights reserved.
9i Release 2 存储模式
      AW$ 表


                   SALES                   SALESAW$ Table              Oracle Data File



                                              AW$SALES




                                SQL> desc aw$sales
                                Name                   Null?    Type
                                ------------------ -------- ------------
                                XTNUM                          NUMBER(8)
                                AWLOB                          BLOB




147   Copyright © 2005, Oracle. All rights reserved.
9i Release 2 存储模式
          AW$ 表
                                             AW$SALES      Oracle Data File



                                              0 – 20 GB
                   SALES
                                              20 – 40 GB


                                              40 – 60 GB


                                              60 – 80 GB


                                             80 – 100 GB




                                       通过增加新的记录来满足数据扩展



148   Copyright © 2005, Oracle. All rights reserved.
9i Release 2 存储模式
      AW$ 表分区
                                             AW$SALES      Oracle Data Files



                                              0 – 20 GB
                   SALES
                                              20 – 40 GB


                                              40 – 60 GB


                                              60 – 80 GB


                                             80 – 100 GB




                                   通过表分区的方法,对 AW$ 表进行分区



149   Copyright © 2005, Oracle. All rights reserved.
Oracle10g 存储模式
                                               AW$SALES     Oracle Data Files



                                                   SALES


                                                   UNITS


                                                   COST


                                           FORECAST_SALES
                 SALES
                                           FORECAST_UNITS




                           分析工作区( AW )中的对象分别存储在不同记录中



150   Copyright © 2005, Oracle. All rights reserved.
Oracle10g 存储模式
                                               AW$SALES     Oracle Data Files



                                                   SALES


                                                   UNITS


                                                   COST


                                           FORECAST_SALES
                 SALES
                                           FORECAST_UNITS




                                   通过表分区的方法,对 AW$ 表进行分区



151   Copyright © 2005, Oracle. All rights reserved.
MULTI 访问方式

      9i Release 2 访问方式
               –   Read only
                      没有对分析工作区( AW )加锁
               –   Read write
                      对分析工作区( AW )加锁,进行写操作
               –   Read write exclusive
                      对分析工作区( AW )加锁,进行读和写操作




152   Copyright © 2005, Oracle. All rights reserved.
MULTI 访问方式

      10g MULTI 访问方式
               –   允许在多个会话中,对 AW 进行读 - 写操作
               –   允许对 AW 中的对象分别进行写操作




153   Copyright © 2005, Oracle. All rights reserved.
MULTI 访问方式


          AW ATTACH sales MULTI                        AW ATTACH sales MULTI
          ACQUIRE actual_sales                         ACQUIRE forecast_sales


          Load new sales data                          Run forecasts


          UPDATE MULTI sales                           UPDATE MULTI sales
          COMMIT                                       COMMIT
          RELEASE actual_sales                         RELEASE forecast_sales




154   Copyright © 2005, Oracle. All rights reserved.
MULTI 访问方式

      通过不同的会话同时进行:
               –   并行数据加载
               –   汇总
               –   分配
               –   预测
               –   ……




155   Copyright © 2005, Oracle. All rights reserved.
分区

      对 AW 中的对象进行分区
      每个分区作为一条记录存在 AW$ 表中
      分区类型
               –   RANGE
               –   LIST
               –   CONCAT




156   Copyright © 2005, Oracle. All rights reserved.
分区

      RANGE 分区
               –   根据维值的范围分区


                                              Customers less than 1000


                                              Customers less than 2000


                     Sales                    Customers less than 3000


                                              Customers less than 4000


                                              Customers less than 5000



157   Copyright © 2005, Oracle. All rights reserved.
分区

      LIST 分区
               –   根据维值的列表分区


                                             <‘JAN03’,’FEB03’,’MAR03’>


                                             <‘APR03’,’MAY03’,’JUN03’>


                     Sales                    <‘JUL03’,’AUG03’,SEP03’>


                                             <‘OCT03’,’NOV03’,’DEC03’>


                                             <‘JAN04’,’FEB04’,’MAR04’>



158   Copyright © 2005, Oracle. All rights reserved.
分区

      CONCAT 分区
               –   根据 CONCAT 维中的基维分区


                                                 TIME2000 dimension     什么是
                                                                      CONCAT 维
                                                 TIME2001 dimension
                                                                         ?

                     Sales                       TIME2002 dimension


                                                 TIME2003 dimension


                                                 TIME2004 dimension



159   Copyright © 2005, Oracle. All rights reserved.
分区

      CONCAT 维
               –   由多个物理维组成的一个逻辑维


                                             TIME2000 dimension

                                             TIME2001 dimension
                                  TIME




                                             TIME2002 dimension

                                             TIME2003 dimension

                                             TIME2004 dimension




160   Copyright © 2005, Oracle. All rights reserved.
分区



                                                          SALES Y2001 partition



                                                  SALES
                                                          SALES Y2002 partition


                                                          SALES Y2002 partition




                                        SALES 作为一个单一变量被访问



161   Copyright © 2005, Oracle. All rights reserved.
D E M O N S T R A T I O N

                                        动手练习


162   Copyright © 2005, Oracle. All rights reserved.
问 题
            • AW 以什么方式存储在关系型表中?
             二进制大对象 (BLOB)


            • 通过使用什么语言,可以将客户化对象加
              入到 AW 中?
             OLAP DML



163   Copyright © 2005, Oracle. All rights reserved.
D E M O N S T R A T I O N

                           EXCEL 访问 演示



164   Copyright © 2005, Oracle. All rights reserved.
集成的 RDBMS-
 MDDS




            –      单一 RDBMS-MDDS 进程
            –      单一数据存储
            –      单一的管理工具
            –      单一的安全角色
            –      单一的 API 及 SQL 访问
            –      利用关系数据库的成熟技术(备份,可靠性,安全性等等)



165   Copyright © 2005, Oracle. All rights reserved.
测试案例
       使用已有 OSA 应用
       14 个度量
       时间维 — 周、月、年 (260)
       产品维 (4,220 ), 客户维 (7,804) 和销售渠道维 (22)
       在产品维和客户维上层次很多
       2 百 90 万条记录
       在 6G 内存的服务器上运行
                –   运行 616 分钟
                –   所占磁盘空间 100GB




166   Copyright © 2005, Oracle. All rights reserved.
测试案例( AWM10g )
        使用单 CPU 、 2G 内存服务器
        所有维度组成一个压缩组合
        在时间维的年度级别上建分区
        运行 51 分钟,所占磁盘空间 1.6GB
        比原来快 12 倍,存储空间只有 1/60




167   Copyright © 2005, Oracle. All rights reserved.
ORACLE OLAP 继承了 DB 的特性

       高度的安全性                                                                1 Node       2 Nodes     3 Nodes      4 Nodes

       网格和 RAC 技术
                                             Concurrent Users                     1,250        2,500       3,750           5,000
       并行计算和分区                              Total Queries per Second               210          412         624             812


       大量的数据计算
                                               6,000

                                               5,000

                                               4,000

                                                                                                       Concurrent Users
                                               3,000
                                                                                                       Total Queries per Second
                                               2,000

                                               1,000

                                                   0
                                                        1 Node      2 Nodes   3 Nodes     4 Nodes




168   Copyright © 2005, Oracle. All rights reserved.
抽象数据类型实例 (ADT) ...
      1. 创建 ADT 记录对象                              create type time_type_row as object (
                                                    month         varchar(10),
                                                    month_label   varchar(6),
                                                    quarter       varchar(3),
                                                    quarter_label varchar(8),
                                                    year          varchar(3),
                                                    year_label    varchar(5));




      2. 创建表对象                                     create type time_type_table
                                                     as table of time_type_row ;




      抽象数据类型提供了一种方法,把非关系型数据映射到关
               系型的数据格式

169   Copyright © 2005, Oracle. All rights reserved.
表函数技术
      实例 …
                           将表函数的定义嵌在关系型视图的定义中:
            create or replace view time_view as
              select *
              from table(OLAP_TABLE(‘production.sales DURATION query',
                             'TIME_TYPE_TABLE',
                             'limit time to levelrel.time ''month''',
                             'DIMENSION month FROM time
                              MEASURE month_label FROM name.time
                              MEASURE quarter FROM time.qtr
                              MEASURE quarter_label FROM time.qtr.name
                              MEASURE year FROM time.year
                              MEASURE year_label FROM time.year.name'
                              ));




170   Copyright © 2005, Oracle. All rights reserved.
Oracle 商务智能
                                    Oracle                           Enterprise
  Oracle   Oracle      Oracle                Oracle Excel Oracle     Planning &
                                  Discoverer
 HTML DB   Reports   Discoverer                Add-In     BI Beans   Budgeting
                                    OLAP




                             Database
               OLAP Option: Query Analysis Planning


     Oracle Warehouse Builder                 Analytic Workspace Manager
OLAP 平台
Oracle Excel                                      Oracle
                   EPB       客户应用      第三方工具                 第三方应用
  Add-In                                        Discoverer




               Business Intelligence Beans

                           OLAP API

                                      SQL

                                  Database
                    OLAP Option: Query Analysis Planning


                            Oracle Warehouse Builder
Oracle OLAP 的结构
                          BI Beans, Reports, Discoverer, Excel-AddIn

                                                   OLAP API

                        R-OLAP                                          M-OLAP
                                                       SQL            (OLAP DML)
                         (SQL)


                                                Oracle Database    Anyalytic Workspaces (AW)   OLAP
                                                                                               DML
  SQL
                     Objets Relation                    OLAP                                    &
               (Tables, Materialized Views)            Catalog     Objets Multidimension       SQL
                                                                   (Cubes, Dimensions)

                                                                     预测     计划
                     Data Warehouse
                                                                 What-If 分析      计算



173   Copyright © 2005, Oracle. All rights reserved.
构建 OLAP 数据仓库                                                            开始决策分析
         使用 Enterprise Manager 和
           AW Manager 的流程
                                                                      OLAP
                                                                      Catalog
                                                                     Dimension
                   OLAP                                              Dimension
                   Catalog                               View        Cube
                                                         over
                 Dimension                                the        Dimension
                 Dimension                               AW          Dimension
                 Cube                                                Cube




  1.                 2.                 3.                4.            5.              6.
  创建               使用                  使用              AW Manager   AW Manager     使用 Discoverer
 星型模型            Enterprise          Analytic           会自动地          会自动地          Plus OLAP
                  Manager           Workspace           在 AW 中       将多维元数         或其他 SQL 工具
                定义多维元数据              Manager            创建视图           添加到             查阅
                  并添加至               创建 AW                          OLAP Catalog    AW 中的数据
                OLAP Catalog          并添加
                                    分析性内容




174   Copyright © 2005, Oracle. All rights reserved.
开始决策分析
                构建 OLAP 数据仓库
               使用 OWB (Paris) 的流程
                                                                     OLAP
                                                                     Catalog
                                                                    Dimension
                   OLAP                                             Dimension
                   Catalog                               View       Cube
                                                         over
                 Dimension                                the       Dimension
                 Dimension                               AW         Dimension
                 Cube                                               Cube




      1.             2.                 3.                4.           5.              6.
    使用
 Warehouse   使用                      使用                Warehouse    Warehouse     使用 Discoverer
   Builder Warehouse               Warehouse            Builder      Builder       Plus OLAP
    把数据     Builder                 Builder             会自动地        会自动地向         或其他 SQL 工具
 从不同的系统 把多维元数据                     创建一个 AW              在 AW 中     OLAP Catalog       查阅
  转换加载到      定义到                     并加入               根据所需的           加入          AW 中的数据
  星型模型中 OLAP Catalog 中             分析性内容                  ADT       多维元数据
                                                        创建视图




175   Copyright © 2005, Oracle. All rights reserved.
Q
                        &      QUESTIONS




177
                         A      ANSWERS




      Copyright © 2005, Oracle. All rights reserved.
1242626441API2 upload

Más contenido relacionado

Destacado

Destacado (7)

J S B6 Ref Booklet
J S B6 Ref BookletJ S B6 Ref Booklet
J S B6 Ref Booklet
 
No[1][1]
No[1][1]No[1][1]
No[1][1]
 
No[1][1]
No[1][1]No[1][1]
No[1][1]
 
Esb
EsbEsb
Esb
 
C A W D A J O P
C A W D A J O PC A W D A J O P
C A W D A J O P
 
Time Management
Time ManagementTime Management
Time Management
 
Stress Management
Stress Management Stress Management
Stress Management
 

Similar a 1242626441API2 upload

[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニング
[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニング[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニング
[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニングオラクルエンジニア通信
 
Testing at the core of digital optimization
Testing at the core of digital optimizationTesting at the core of digital optimization
Testing at the core of digital optimizationFlorian Pihs
 
企业级搜索引擎Solr交流
企业级搜索引擎Solr交流企业级搜索引擎Solr交流
企业级搜索引擎Solr交流chuan liang
 
20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編mochiko AsTech
 
PMT-010-生產與作業管理
PMT-010-生產與作業管理PMT-010-生產與作業管理
PMT-010-生產與作業管理handbook
 
Chinaonrails Rubyonrails21 Zh
Chinaonrails Rubyonrails21 ZhChinaonrails Rubyonrails21 Zh
Chinaonrails Rubyonrails21 ZhJesse Cai
 
Gorm @ gopher china
Gorm @ gopher chinaGorm @ gopher china
Gorm @ gopher chinaJinzhu
 
Working With Rails
Working With RailsWorking With Rails
Working With RailsDali Wang
 
CRE-016-商業智慧
CRE-016-商業智慧CRE-016-商業智慧
CRE-016-商業智慧handbook
 
Ruby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionRuby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionLibin Pan
 
090309seminar talk about Cloud Computing
090309seminar talk about Cloud Computing090309seminar talk about Cloud Computing
090309seminar talk about Cloud ComputingKohei Nishikawa
 
Richard Databoard
Richard DataboardRichard Databoard
Richard Databoard巍 陆
 
テンプレート管理ツール r3
テンプレート管理ツール r3テンプレート管理ツール r3
テンプレート管理ツール r3Ippei Ogiwara
 
Fy09 Q3行動咖啡館 微軟虛擬化解決方案
Fy09 Q3行動咖啡館 微軟虛擬化解決方案Fy09 Q3行動咖啡館 微軟虛擬化解決方案
Fy09 Q3行動咖啡館 微軟虛擬化解決方案Ada Lin
 
Tcl/Tk+ハッシュリスト
Tcl/Tk+ハッシュリストTcl/Tk+ハッシュリスト
Tcl/Tk+ハッシュリストHiromu Shioya
 
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」devsumi2009
 
Developer Summit 2009 Salesforce.com
Developer Summit 2009 Salesforce.comDeveloper Summit 2009 Salesforce.com
Developer Summit 2009 Salesforce.comMitch Okamoto
 
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法devsumi2009
 

Similar a 1242626441API2 upload (20)

[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニング
[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニング[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニング
[Oracle DBA & Developer Day 2014] しばちょう先生による特別講義! RMANの運用と高速化チューニング
 
Testing at the core of digital optimization
Testing at the core of digital optimizationTesting at the core of digital optimization
Testing at the core of digital optimization
 
企业级搜索引擎Solr交流
企业级搜索引擎Solr交流企业级搜索引擎Solr交流
企业级搜索引擎Solr交流
 
20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編
 
PMT-010-生產與作業管理
PMT-010-生產與作業管理PMT-010-生產與作業管理
PMT-010-生產與作業管理
 
Chinaonrails Rubyonrails21 Zh
Chinaonrails Rubyonrails21 ZhChinaonrails Rubyonrails21 Zh
Chinaonrails Rubyonrails21 Zh
 
Gorm @ gopher china
Gorm @ gopher chinaGorm @ gopher china
Gorm @ gopher china
 
Working With Rails
Working With RailsWorking With Rails
Working With Rails
 
CRE-016-商業智慧
CRE-016-商業智慧CRE-016-商業智慧
CRE-016-商業智慧
 
Ruby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionRuby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese Version
 
090309seminar talk about Cloud Computing
090309seminar talk about Cloud Computing090309seminar talk about Cloud Computing
090309seminar talk about Cloud Computing
 
Richard Databoard
Richard DataboardRichard Databoard
Richard Databoard
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
 
テンプレート管理ツール r3
テンプレート管理ツール r3テンプレート管理ツール r3
テンプレート管理ツール r3
 
Revisited
RevisitedRevisited
Revisited
 
Fy09 Q3行動咖啡館 微軟虛擬化解決方案
Fy09 Q3行動咖啡館 微軟虛擬化解決方案Fy09 Q3行動咖啡館 微軟虛擬化解決方案
Fy09 Q3行動咖啡館 微軟虛擬化解決方案
 
Tcl/Tk+ハッシュリスト
Tcl/Tk+ハッシュリストTcl/Tk+ハッシュリスト
Tcl/Tk+ハッシュリスト
 
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
 
Developer Summit 2009 Salesforce.com
Developer Summit 2009 Salesforce.comDeveloper Summit 2009 Salesforce.com
Developer Summit 2009 Salesforce.com
 
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
 

Más de 51 lecture

1244600439API2 upload
1244600439API2 upload1244600439API2 upload
1244600439API2 upload51 lecture
 
1242982622API2 upload
1242982622API2 upload1242982622API2 upload
1242982622API2 upload51 lecture
 
1242982374API2 upload
1242982374API2 upload1242982374API2 upload
1242982374API2 upload51 lecture
 
1242625986my upload
1242625986my upload1242625986my upload
1242625986my upload51 lecture
 
1242361147my upload ${file.name}
1242361147my upload ${file.name}1242361147my upload ${file.name}
1242361147my upload ${file.name}51 lecture
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test51 lecture
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test51 lecture
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test51 lecture
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test51 lecture
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test51 lecture
 
this is test api2
this is test api2this is test api2
this is test api251 lecture
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!51 lecture
 
Iim A Managment
Iim A ManagmentIim A Managment
Iim A Managment51 lecture
 
Conversation By Design
Conversation By DesignConversation By Design
Conversation By Design51 lecture
 
dynamics-of-wikipedia-1196670708664566-3
dynamics-of-wikipedia-1196670708664566-3dynamics-of-wikipedia-1196670708664566-3
dynamics-of-wikipedia-1196670708664566-351 lecture
 
Tech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM WorkflowsTech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM Workflows51 lecture
 
javascript reference
javascript referencejavascript reference
javascript reference51 lecture
 

Más de 51 lecture (20)

1244600439API2 upload
1244600439API2 upload1244600439API2 upload
1244600439API2 upload
 
1242982622API2 upload
1242982622API2 upload1242982622API2 upload
1242982622API2 upload
 
1242982374API2 upload
1242982374API2 upload1242982374API2 upload
1242982374API2 upload
 
1242625986my upload
1242625986my upload1242625986my upload
1242625986my upload
 
1242361147my upload ${file.name}
1242361147my upload ${file.name}1242361147my upload ${file.name}
1242361147my upload ${file.name}
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test
 
this is ruby test
this is ruby testthis is ruby test
this is ruby test
 
this is test api2
this is test api2this is test api2
this is test api2
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
Iim A Managment
Iim A ManagmentIim A Managment
Iim A Managment
 
Conversation By Design
Conversation By DesignConversation By Design
Conversation By Design
 
Web 2.0
Web 2.0Web 2.0
Web 2.0
 
dynamics-of-wikipedia-1196670708664566-3
dynamics-of-wikipedia-1196670708664566-3dynamics-of-wikipedia-1196670708664566-3
dynamics-of-wikipedia-1196670708664566-3
 
Tech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM WorkflowsTech_Implementation of Complex ITIM Workflows
Tech_Implementation of Complex ITIM Workflows
 
javascript reference
javascript referencejavascript reference
javascript reference
 
No[1][1]
No[1][1]No[1][1]
No[1][1]
 
No[1][1]
No[1][1]No[1][1]
No[1][1]
 

1242626441API2 upload

  • 1. Oracle Technical Workshop Oracle Data Warehouse & Business Intelligence Solution
  • 3. OLAP 技术背景  60 年代,关系数据库之父 E.F.Codd 提出了关系模型,促进了联 机事务处理 (OLTP) 的发展 ( 数据以表格的形式而非文件方式存 储 ) 。 1993 年, E.F.Codd 提出了 OLAP 概念,认为 OLTP 已不 能满足终端用户对数据库查询分析的需要, SQL 对大型数据库进 行的简单查询也不能满足终端用户分析的要求。用户的决策分析 需要对关系数据库进行大量计算才能得到结果,而查询的结果并 不能满足决策者提出的需求。因此, E.F.Codd 提出了多维数据 库和多维分析的概念,即 OLAP 。  OLTP 数据 OLAP 数据  原始数据 导出数据  细节性数据 综合性和提炼性数据  当前值数据 历史数据  可更新 不可更新,但周期性 刷新  一次处理的数据量小 一次处理的数据量大  面向应用,事务驱动 面向分析,分析驱动 3 Copyright © 2005, Oracle. All rights reserved.
  • 4. 相关基本概念 1. 维:是人们观察数据的特定角度,是考虑问题时的一 类属性,属性集合构成一个维 ( 时间维、地理维等 ) 。 2. 维的层:人们观察数据的某个特定角度 ( 即某个维 ) 还可以存在细节程度不同的各个描述方面 ( 时间维:日 期、月份、季度、年 ) 。 3. 维的成员:维的一个取值。是数据项在某维中位置的 描述。 (“ 某年某月某日”是在时间维上位置的描述 ) 4. 维的分层:维层次的组合(如年月日,年季月日) 5. 数据单元 ( 单元格 ) :多维数组的取值。 (2000 年 1 月,上海,笔记本电脑, $100000) 4 Copyright © 2005, Oracle. All rights reserved.
  • 5. OLAP 分类 OLAP 按照存储方式 按照处理地点 ROLAP MOLAP HOLAP Server OLAP Client OLAP 5 Copyright © 2005, Oracle. All rights reserved.
  • 6. ROLAP / MOLAP 定义 : ROLAP = 基于关系的 OLAP MOLAP = 基于多维的 OLAP 6 Copyright © 2005, Oracle. All rights reserved.
  • 7. OLTP 、 ROLAP 与 MOLAP 模式 7 Copyright © 2005, Oracle. All rights reserved.
  • 8. ROLAP 的星型模式 (Star Schema) Market Table Period Table Market_id Time_id Sales Table Market_Desc Period_Desc District Quarter Region Time_id Year Product_id quot;Dimension Tablequot; quot;Dimension Tablequot; Market_id Scenario Product Table Dollars Product_id Units Product_Desc Scenario Table Discount% Scenario Brand Size quot;Fact Tablequot; Actual quot;Dimension Tablequot; Profit  事实表:用来存储事实的度量值和各个维的码值。 Budget Tablequot; quot;Dimension 维 表:用来存放维的元数据(维的层次、成员类别等描述信息 )。 8 Copyright © 2005, Oracle. All rights reserved.
  • 9. MOLAP 的 多维立方体 (Multicube) 9 Copyright © 2005, Oracle. All rights reserved.
  • 10. ROLAP 与 MOLAP 比较 MOLAP 优势 MOLAP 缺点 – 性能好、响应速度快 – 增加系统复杂度 – 专为 OLAP 所设计 – 需要进行预计算,可能导致 数据爆炸 – 支持高性能的决策支持 计算 复杂的跨维计算 多用户的读写操作 10 Copyright © 2005, Oracle. All rights reserved.
  • 11. OLAP 发展 从联机分析处理到联机分析挖掘 (OLAM/OLAP 挖掘 ) ROLAP 与 MOLAP 的结合 11 Copyright © 2005, Oracle. All rights reserved.
  • 12. 12 Copyright © 2005, Oracle. All rights reserved.
  • 13. Oracle 对数据仓库的理解 数据仓库是一个过程,而不是一个产品 。 决策 使用 获取 知识 数据 管理 信息 数据仓库: 对来自不同的数据源的大量杂乱的信息进行统一处理 及管理,通过灵活的展现方法从中提炼出有规律的、 数据 可重复使用的知识来帮助决策支持,并将可以重复使 用的知识转化为企业的核心竞争力。 13 Copyright © 2005, Oracle. All rights reserved.
  • 14. 传统的数据仓库解决方案 Web Site OLAP Reporting Portal ERP Brand C Ad-Hoc Query Legacy Data Mining Analysis RDBMS Brand A Brand B Brand D Brand E Brand F 14 Copyright © 2005, Oracle. All rights reserved.
  • 15. 传统的数据仓库解决方案 多种软件组成 Web Site OLAP Reporting Portal 非集成的方案 ERP Ad-Hoc Query 凌乱的平台 Legacy Data Mining Analysis 技术、接口复杂 RDBMS 数据迁移时间长 15 Copyright © 2005, Oracle. All rights reserved.
  • 16. Oracle 商业智能分析应用 -实现战略企业管理 • 情景测试 Oracle Balanced • 战略目标建立 Scorecard • 记分卡 Oracle BI Beans / • 预测 Global Consolidation 建立目标 •System 合并报表 • 收入 • 管理 Oracle ABM • 资源 建 • 法律和法定 告 • 约束条件 模 • 财务 • 利润 报 共享 Oracle 9i/10g 信息 分 • 收益率 • 财务规划 划 析 • 差异 • 资源分配 规 • 效益 • 预算 Oracle • 偏差 Business Daily Oracle Daily Business Oracle•Enterprise 要求 Intelligence / Financial 监控 Planning & Analyzer / Discovery • 绩效度量 Budgeting • 效率和利用 Oracle ERP / • 基准 Sales / Marketing 16 Copyright © 2005, Oracle. All rights reserved.
  • 17. Oracle BI 产品定位 应用 高级的分析、计划 Oracle Oracle 工具 Reports Discoverer Business Intelligence Beans & JDeveloper OLAP Services - Java OLAP API 应用程序接口 SQL OLAP 静态报表 特殊报表 分析 预测分析 分析强度 17 Copyright © 2005, Oracle. All rights reserved.
  • 18. Oracle OLAP – OLAP 选件 – OLAP 术语 – ROLAP 和 MOLAP – OLAP 详细技术 – OLAP 访问方式 18 Copyright © 2005, Oracle. All rights reserved.
  • 19. Oracle 数据仓库平台 完整集成的服务器 ETL OLAP Data Mining 19 Copyright © 2005, Oracle. All rights reserved.
  • 20. 什么是 OLAP 选项 ? OLAP 选项提供了一种执行分析性计算的能力 ,这种能力已超越普通 SQL 所具备的功能 . 如果安装了 OLAP 选项 , 就可以同时对关系型 数据类型和多维数据类型执行计算 20 Copyright © 2005, Oracle. All rights reserved.
  • 21. 什么是 OLAP 选项 ? 包括 :  一个强大的 SQL 计算引擎  一个强大的多维计算引擎  多维数据的存储和检索  面向 SQL 、 PL/SQL 和 Java 程序的 API  面向多维数据的数据操作语言 (DML)  能够访问多维数据的 SQL 21 Copyright © 2005, Oracle. All rights reserved.
  • 22. OLAP Server 即席查询工具已经可以实现旋转、下钻和累计 汇总等功能,我们是否还需要 OLAP 引擎 ? 22 Copyright © 2005, Oracle. All rights reserved.
  • 23. OLAP Server 使用 SQL 工具,用户能够: 旋转数据的视图 按照层次( hierarchy )下钻和上钻 创建简单的计算 23 Copyright © 2005, Oracle. All rights reserved.
  • 24. OLAP Server 但是用户不能方便地: 发现哪些顾客本周购买了产品‘ A’ ,而上周却 没有购买 在不同的级别 (level) ,分析 2 张事实表中的数 据 ( 如按日分析实际销售 , 按月分析预算 ) 生成数据 ( 模型 , 预测 , 分配 ) 24 Copyright © 2005, Oracle. All rights reserved.
  • 25. OLAP Server District Product Boston New York Tents Philadelphia 查询实例: Canoes 从费城( Philadelphia ) 销售额最大的产品中(上 Racquets 个季度中,销售额至少达 到 $150K ),选出利润率 Sportswear 最高的前 2 位产品 Footwear Q1 Q2 Q3 Q4 Time 25 Copyright © 2005, Oracle. All rights reserved.
  • 26. OLAP Server District Product Boston New York Tents Philadelphia 查询实例: Canoes  Limit Time to last 1 Racquets Sportswear Footwear Q1 Q2 Q3 Q4 Time 26 Copyright © 2005, Oracle. All rights reserved.
  • 27. OLAP Server District Product Boston New York Tents Philadelphia 查询实例: Canoes  Limit Time to last 1  Limit District to Racquets ‘Philadelphia’ Sportswear Footwear Q1 Q2 Q3 Q4 Time 27 Copyright © 2005, Oracle. All rights reserved.
  • 28. OLAP Server District Product Boston New York Tents Philadelphia 查询实例: Canoes  Limit Time to last 1  Limit District to Racquets ‘Philadelphia’  Limit Product to Sales Sportswear > 150,000 Footwear Q1 Q2 Q3 Q4 Time 28 Copyright © 2005, Oracle. All rights reserved.
  • 29. OLAP Server District Product Boston New York Tents Philadelphia 查询实例: Canoes  Limit Time to last 1  Limit District to Racquets ‘Philadelphia’  Limit Product to Sales Sportswear > 150,000  Limit Product keep Footwear Top 2 BasedOn Profit Q1 Q2 Q3 Q4 Time 29 Copyright © 2005, Oracle. All rights reserved.
  • 30. OLAP Server 内嵌函数 (Built-In Functions) 范 例 数值 / 时间序列函数 财务函数 Average Depreciation Cumulative Sums Growth Rate Lag/Lead Net Present Value Variance Internal Rate of Return Moving Average/Total 其他函数 Smallest/Largest Forecasting Standard Deviation Regression Total … 或者创建自定义函数 30 Copyright © 2005, Oracle. All rights reserved.
  • 31. Oracle OLAP 选项的发展历史  随着技术发展不断进步 Express – 1970s – MDS Express MDB – 1980s Express Server – 1990s – Oracle OLAP Option … 现在集成在 Oracle 的数据库中 31 Copyright © 2005, Oracle. All rights reserved.
  • 32. OLAP 服务器  集成的服务器技术和安全模式  单点安全管理  充分利用 Oracle 的并行技术和分区技术  通过 SQL 进行访问 PRODUCT REGION MONTH SALES PRODUCT REGION MONTH SALES RECORD #1 FILM EAST Dec-93 240 RECORD #1 FILM EAST Dec-93 240 RECORD #2 LENSES WEST Jan-94 250 RECORD #2 LENSES WEST Jan-94 250 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #4 FILM WEST Mar-94 425 RECORD #4 FILM WEST Mar-94 425 RECORD #5 LENSES EAST Apr-94 300 RECORD #5 LENSES EAST Apr-94 300 RECORD #6 FILM WEST May-94 500 RECORD #6 FILM WEST May-94 500 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #8 LENSES WEST Jul-94 400 RECORD #8 LENSES WEST Jul-94 400 RECORD #9 FILM EAST Aug-94 800 RECORD #9 FILM EAST Aug-94 800 Tables, Views, Dimensions Analytic Workspace Oracle Database 32 Copyright © 2005, Oracle. All rights reserved.
  • 33. OLAP 服务器 分析工作区( Analytic Workspace ) 同 Express 功能类似 – Express 程序无需改动就可以在 AW 中运行 – 完善的分析功能 – 强大而细致的 What-if 、预测 分析 PRODUCT REGION MONTH SALES PRODUCT REGION MONTH SALES RECORD #1 FILM EAST Dec-93 240 RECORD #1 FILM EAST Dec-93 240 RECORD #2 LENSES WEST Jan-94 250 RECORD #2 LENSES WEST Jan-94 250 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #4 FILM WEST Mar-94 425 RECORD #4 FILM WEST Mar-94 425 RECORD #5 LENSES EAST Apr-94 300 RECORD #5 LENSES EAST Apr-94 300 RECORD #6 FILM WEST May-94 500 RECORD #6 FILM WEST May-94 500 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #8 LENSES WEST Jul-94 400 RECORD #8 LENSES WEST Jul-94 400 RECORD #9 FILM EAST Aug-94 800 RECORD #9 FILM EAST Aug-94 800 Tables, Views, Dimensions Analytic Workspace Oracle Database 33 Copyright © 2005, Oracle. All rights reserved.
  • 34. OLAP 服务器 能够访问关系表和多维数据 提供建立“立方体”的选项 OLAP Option Query Multi Dimensional SQL Generator Processor Engine PRODUCT REGION MONTH SALES PRODUCT REGION MONTH SALES RECORD #1 FILM EAST Dec-93 240 RECORD #1 FILM EAST Dec-93 240 RECORD #2 LENSES WEST Jan-94 250 RECORD #2 LENSES WEST Jan-94 250 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #4 FILM WEST Mar-94 425 RECORD #4 FILM WEST Mar-94 425 RECORD #5 LENSES EAST Apr-94 300 RECORD #5 LENSES EAST Apr-94 300 RECORD #6 FILM WEST May-94 500 RECORD #6 FILM WEST May-94 500 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #8 LENSES WEST Jul-94 400 RECORD #8 LENSES WEST Jul-94 400 RECORD #9 FILM EAST Aug-94 800 RECORD #9 FILM EAST Aug-94 800 Tables, Views, Dimensions Analytic Workspace Oracle Database 34 Copyright © 2005, Oracle. All rights reserved.
  • 35. OLAP 服务器 – 开放的访问机制 Any SQL Application View Table Function PRODUCT REGION MONTH SALES PRODUCT REGION MONTH SALES RECORD #1 FILM EAST Dec-93 240 RECORD #1 FILM EAST Dec-93 240 RECORD #2 LENSES WEST Jan-94 250 RECORD #2 LENSES WEST Jan-94 250 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #4 FILM WEST Mar-94 425 RECORD #4 FILM WEST Mar-94 425 RECORD #5 LENSES EAST Apr-94 300 RECORD #5 LENSES EAST Apr-94 300 RECORD #6 FILM WEST May-94 500 RECORD #6 FILM WEST May-94 500 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #8 LENSES WEST Jul-94 400 RECORD #8 LENSES WEST Jul-94 400 RECORD #9 FILM EAST Aug-94 800 RECORD #9 FILM EAST Aug-94 800 Tables, Views, Dimensions Analytic Workspace Oracle Database 35 Copyright © 2005, Oracle. All rights reserved.
  • 36. OLAP 服务器 – Java OLAP API Business Intelligence Beans OLAP Option Java OLAP API Query Multi Dimensional SQL Generator Processor Engine PRODUCT REGION MONTH SALES PRODUCT REGION MONTH SALES RECORD #1 FILM EAST Dec-93 240 RECORD #1 FILM EAST Dec-93 240 RECORD #2 LENSES WEST Jan-94 250 RECORD #2 LENSES WEST Jan-94 250 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #3 CAMERAS CENTRAL Feb-94 690 RECORD #4 FILM WEST Mar-94 425 RECORD #4 FILM WEST Mar-94 425 RECORD #5 LENSES EAST Apr-94 300 RECORD #5 LENSES EAST Apr-94 300 RECORD #6 FILM WEST May-94 500 RECORD #6 FILM WEST May-94 500 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #7 CAMERAS CENTRAL Jun-94 125 RECORD #8 LENSES WEST Jul-94 400 RECORD #8 LENSES WEST Jul-94 400 RECORD #9 FILM EAST Aug-94 800 RECORD #9 FILM EAST Aug-94 800 Tables, Views, Dimensions Analytic Workspace Oracle Database 36 Copyright © 2005, Oracle. All rights reserved.
  • 37. OLAP 的相关信息  版本 RDBMS/OLAP – Oracle 9i ( 9.2.0.1 – 9.2.0.6 ) – Oracle 10g ( 10.1.0.2 – 10.1.0.4 ) AW Manager – 10.1.0.4 Discoverer – Drake OWB - Paris  http://metalink.oracle.com 提供 RDBMS 和 OLAP patch 的下载  http://www.oracle.com 提供 AW Manager 的下载 37 Copyright © 2005, Oracle. All rights reserved.
  • 38. Oracle OLAP – OLAP 选件 – OLAP 术语 – ROLAP 和 MOLAP – OLAP 详细技术 – OLAP 访问方式 38 Copyright © 2005, Oracle. All rights reserved.
  • 39. 术语 o OLAP – 联机分析处理 ( 同在线事务处理 OLTP 相对应 ) o ROLAP – 基于关系型数据库的 OLAP :在关系型数据 上建立多维视图 o MOLAP – 基于多维数据库的 OLAP: 数据以多维度的方 式存储在分析工作区( Analytic Workspace )中 o Analytic Workspace (AW) – 多维方案 (multidimensional schema) ,以 BLOB 的形式存储在 Oracle 数据库中 , 包含维度、变量、层次、程序等对象 39 Copyright © 2005, Oracle. All rights reserved.
  • 40. 术语 o 维度 (Dimension) – 一个用来给数据分类的结构 ( 如 Time, Geography, Product) o 层次 ( Hierarchy ) – 在维度中预定义的不同级别,用来 实现汇总和钻取功能 o 度量 ( Measure ) – 用来存储(或计算)多维数据;类 似于实事列 (fact column) o 公式 (Formula) – 在 AW 中一个经计算的度量 o 立方体 (Cube) – 由具有相同维度的度量组成的逻辑结构 40 Copyright © 2005, Oracle. All rights reserved.
  • 41. 术语 o CWM 元数据 – 用来描述数据和其他对象的数 据。 OLAP catalog 就是一种元数据,以多维数 据的术语描述数据,如立方体、度量、维度和属 性。 o DML – 数据操作语言: Analytic Workspaces 所使用的面向多维数据的 编程语言 41 Copyright © 2005, Oracle. All rights reserved.
  • 42. 术语 o OLAPI – OLAP API, BI Beans 通过 OLAP API 同 AW 进行通讯。由 OLAPI 生成 SQL 语 句 o AW View – 一种视图,使 SQL 语句能够在 AW 中访问多维对象 o 物化视图 (Materialized view) – 一种预计 算的关系型汇总表,由汇总数据组成,用来提 高 ROLAP 的性能。 42 Copyright © 2005, Oracle. All rights reserved.
  • 43. Oracle OLAP – OLAP 选件 – OLAP 术语 – ROLAP 和 MOLAP – OLAP 详细技术 – OLAP 访问方式 43 Copyright © 2005, Oracle. All rights reserved.
  • 44. 问 题 • OLAP 按照存储方式可以分为几类?  ROLAP 、 MOLAP 、 HOLAP • AW 的中、英文全称是什么?  分析工作区、 Analytic Workspace 44 Copyright © 2005, Oracle. All rights reserved.
  • 45. ROLAP Select a ROLAP implementation when the analytic requirements of the business are met by the capabilities of SQL.  Easy to implement  Relational tables with cubes defined by OLAP metadata  Beans access via the OLAP API generated SQL  Materialized Views for better performance 45 Copyright © 2005, Oracle. All rights reserved.
  • 46. MOLAP Select a MOLAP implementation when the analytic requirements of the business need the extended analytic, forecasting and planning functionality provided by the Analytic Workspace.  Can use OLAP DML to add analytic capability to the AW  AWs are stored in relational tables  AW can be enabled for use with BI Beans or other SQL clients 46 Copyright © 2005, Oracle. All rights reserved.
  • 47. Oracle OLAP – OLAP 选件 – OLAP 术语 – ROLAP 和 MOLAP – OLAP 详细技术 – OLAP 访问方式 47 Copyright © 2005, Oracle. All rights reserved.
  • 48. Oracle OLAP 的组件架构 Oracle Database JDBC Oracle Call Interface OLAP API Relational Technology Object Technology OLAP Technology Multidimensional SQL Engine Table Functions Engine Storage OLAP Catalog Relational Data Multidimensional Data 48 Copyright © 2005, Oracle. All rights reserved.
  • 49. 元数据 /Metadata 49 Copyright © 2005, Oracle. All rights reserved.
  • 50. 元数据 -- Metadata 元数据是什么 – 逻辑的多维数据模型 – 同关系数据库对象的映射关系 – 同 Analytic Workspace 对象的映射关系 为什么使用元数据 – 供 OLAP API 和 Oracle 工具使用 怎样使用元数据 – 通过 Oracle Enterprise Manager – 通过 Oracle Warehouse Builder – 通过 PL/SQL API 元数据存储在哪里 – OLAP Catalog 50 Copyright © 2005, Oracle. All rights reserved.
  • 51. 元数据 -- Metadata 描述逻辑数据模型 – 如 dimension, level, hierarchy, attribute.  逻辑模型中的对象反映的是人们对业务的认识。这样 的模型带给最终用户简单易用的体验。 将逻辑数据模型映射到物理实现 – 如将逻辑对象映射到表或视图的列 .  把应用程序的数据模型同物理实现隔离开,可以构建 更稳固的应用程序。 51 Copyright © 2005, Oracle. All rights reserved.
  • 52. 元数据 -- Metadata 整个元数据资料库 (Metadata Repository) 统称为 OLAP Catalog OLAP Catalog 由下列表组成:  CWM 1 关系表  CWM 2 关系表  AW 字典  Oracle 数据字典 52 Copyright © 2005, Oracle. All rights reserved.
  • 53. 元数据 -- Metadata Oracle 提供了一些工具和 API 来定义元数据。 其中一个重要的工具是 Enterprise Manager. 这是一个易用的数据库管理工具, 能够定义星型模型或雪花模型的 OLAP 元数据 Oem.lnk 53 Copyright © 2005, Oracle. All rights reserved.
  • 54. 对象类型 /Object Types 54 Copyright © 2005, Oracle. All rights reserved.
  • 55. OLAP 对象类型 • 抽象数据类型 -- Abstract data types (ADTs) • 表函数技术 -- Table function 55 Copyright © 2005, Oracle. All rights reserved.
  • 56. 抽象数据类型实例 (ADT) ... 1. 创建 ADT 记录对象 create type time_type_row as object ( month varchar(10), month_label varchar(6), quarter varchar(3), quarter_label varchar(8), year varchar(3), year_label varchar(5)); 2. 创建表对象 create type time_type_table as table of time_type_row ; 抽象数据类型提供了一种方法,把非关系型数据映射到关 系型的数据格式 56 Copyright © 2005, Oracle. All rights reserved.
  • 57. 表函数技术 表函数技术可以用来 实现非关系型数据源和数据库 之间的通信。 57 Copyright © 2005, Oracle. All rights reserved.
  • 58. 表函数技术 • 表函数能够将非关系型数据映射为关系 型数据格式。 • 表函数能够将来自于非关系型数据源的 数据物理地转化为关系型视图。 • OLAP_TABLE 表函数生成 DML ,这 样就能与 AW 进行交互。 58 Copyright © 2005, Oracle. All rights reserved.
  • 59. 表函数技术 实例 … 将表函数的定义嵌在关系型视图的定义中: create or replace view time_view as select * from table(OLAP_TABLE(‘production.sales DURATION query', 'TIME_TYPE_TABLE', 'limit time to levelrel.time ''month''', 'DIMENSION month FROM time MEASURE month_label FROM name.time MEASURE quarter FROM time.qtr MEASURE quarter_label FROM time.qtr.name MEASURE year FROM time.year MEASURE year_label FROM time.year.name' )); 59 Copyright © 2005, Oracle. All rights reserved.
  • 60. 表函数技术 实例… 在 SELECT 语句中,使用表函数: SQL> select time_id, channel_id, product_id, customer_id, sales, custmeas_1 MONTH_AGO, custmeas_2 CHG, custmeas_3 PCT_CHG from table(OLAP_TABLE('production.sales DURATION query', 'SALES_TYPE_TABLE', ‘FORECAST_SALES', 'DIMENSION time_id FROM time DIMENSION channel_id FROM channel DIMENSION product_id FROM product DIMENSION customer_id FROM customer MEASURE sales FROM sales MEASURE custmeas_1 from custmeas_1 MEASURE custmeas_2 from custmeas_2 MEASURE custmeas_3 from custmeas_3')) where time_level = ('MONTH') and channel_id = '5' and product_id = '70' and customer_id in ('114') order by customer_id, time_id; 60 Copyright © 2005, Oracle. All rights reserved.
  • 61. 表函数技术 表函数的运行机制 APPLICATION 通过 OCI 或 JDBC SELECT 语句 返回数据 RELATIONAL ENGINE 分析 Select 列表和 WHERE 子句 以关系格式返回数据 OLAP_TABLE OLAP DML 以多维格式返回数据 汇总和计算 MULTIDIMENSIONAL ENGINE Analytic Workspace 61 Copyright © 2005, Oracle. All rights reserved.
  • 62. Oracle OLAP – OLAP 选件 – OLAP 术语 – ROLAP 和 MOLAP – OLAP 详细技术 – OLAP 访问方式 62 Copyright © 2005, Oracle. All rights reserved.
  • 63. Oracle OLAP – 多种访问方式 OLAP API Generic SQL ‘OLAP aware’ SQL Application Application Application OLAP API OCI or JDBC OCI or JDBC Select … from Select … from SQL Generator Select … from View/table View/table view RDBMS View Table Function Select … from OLAP_TABLE •DBMS_AW.EXECUTE •DBMS_AW.INTERP •DBMS_AW.INTERPCLOB Relational Multidimensional 63 Copyright © 2005, Oracle. All rights reserved.
  • 64. 开放访问的特点  OLAP 满足多种需求 企业对报表和应用程序的需求可能会各不相同。  有些用户只需要一个简单的报表工具,如 HTML DB 。  有些用户需要功能更复杂的电子表格工具,如 Excel add-in 或 Discoverer Plus OLAP 。  还有一些用户需要通过 BI Beans ,构建专用的 分析应用。 64 Copyright © 2005, Oracle. All rights reserved.
  • 65. 前端工具的种类 8. 任何 SQL 接口 的查询工具 7. 用户自定义 1. 简单的报表工具,可以执 的应用程序 行预定义的 SQL 语句,无须 了解 OLAP 。 6. 电子表格工具 DW 2. 支持 OLAP 的查 ETL 询工具,能够通过 OLAP SQL 。 Data Mining 5. 支持 OLAP 的 3. 支持 多维数据对象 应用程序构建工 和 OLAP 的查询工具 具 4. 能够以多种样式 ,能够通过 SQL 。 严格定义报表格式 的工具。 65 Copyright © 2005, Oracle. All rights reserved.
  • 66. Oracle 前端工具 8. 任何 SQL 接口的查询工 具 7. 用户自定义的 1. 简单的报表工具,可以执 SQL, PL/SQL 应用程序 行预定义的 SQL 语句,无须 OLAP Java API 了解 OLAP 。 HTML DB 6. 电子表格工具 DW 2. 支持 OLAP 的查 Oracle Excel Add-in ETL 询工具,能够通过 OLAP SQL 。 Discoverer Data Mining for OLAP 5. 支持 OLAP 的 3. 支持多维数据对象和 应用程序构建工 OLAP 的查询工具,能够通 具 4. 能够以多种样式严 过 SQL 。 BI Beans 格定义报表格式的工 Discoverer for OLAP Plus 具。 Reports 66 Copyright © 2005, Oracle. All rights reserved.
  • 67. 多维数据访问的实例 • HTML DB – 简单的报表工具,无须了解 OLAP 。 • 新 ! Discoverer Plus OLAP – 一个非常有用 的 OLAP 工具,支持 OLAP 查询的构建和多维数据 查询结果的展示。 • BI Beans – 支持 OLAP 的组件,可以用来快速 开发客户自定义应用程序。 67 Copyright © 2005, Oracle. All rights reserved.
  • 68. Oracle HTML DB 68 Copyright © 2005, Oracle. All rights reserved.
  • 69. Oracle HTML DB  建立交互式的 WEB 应用  易用性和高效性的结合,同时具有所有 Oracle 数据库的特点 : 可用性、扩展性、安全 性  快速开发分析性的应用和报表  无需 OLAP 支持的基础  需要使用者具有 SQL 使用的经验 69 Copyright © 2005, Oracle. All rights reserved.
  • 70. Oracle HTML DB 访问结构 HTML Database Relational Views OLAP_TABLE Relational Multidimensional 70 Copyright © 2005, Oracle. All rights reserved.
  • 71.
  • 72. 当前的 HTML DB web 报表包含了 在 Oracle AW 内执行的计算结果 让我们继续深入观看
  • 74. Oracle HTML DB  报表内的数据来源于 AW  HTML DB 成为简单的报表工具而无需 OLAP 的知识 , SQL 命令的执行方式极为简单  报表制作无需 AW 的知识 . 只需要知道如何针对 view 书写 SQL 语句  HTML DB 的价值就是极大的提高访问 AW 内部数据 的简单性 74 Copyright © 2005, Oracle. All rights reserved.
  • 75. Discoverer Plus OLAP 75 Copyright © 2005, Oracle. All rights reserved.
  • 76. Discoverer Plus OLAP  OLAP 工具  支持多维数据  提供例外分析和基于排名的选择  用户不需要 SQL 经验  由 Oracle BI Beans 开发 76 Copyright © 2005, Oracle. All rights reserved.
  • 77. Discoverer Plus OLAP 访问结构 Discoverer Plus OLAP OLAP API Relational Views OLAP_TABLE Relational Multidimensional 77 Copyright © 2005, Oracle. All rights reserved.
  • 78. 使用 Discoverer Plus 导 向工具建立报表
  • 81. 注意此导向工具是与 Oracle OLAP Server 直接匹配的 , 所 以一旦你选中了一个 measure, 与此相关的所有 dimension 都 会自动被选中 .
  • 84. 点击 Finish 来查看报表 , 并根据 你的需求进行客户化
  • 85. Discoverer Plus OLAP • Discoverer Plus OLAP 完全支持多维数据模型,无 论该模型是 ROLAP 方式或 MOLAP 方式。 • 用户界面支持对多维数据进行操作。 • 能够轻而易举地建立例外和排名报表。 • 制作报表的人员无须具有 AW ,或 SQL 的知识。 85 Copyright © 2005, Oracle. All rights reserved.
  • 86. BI Beans 86 Copyright © 2005, Oracle. All rights reserved.
  • 87. BI Beans • 为交互式分析应用构建组件 • BI Beans 能够集成在任何的 Java 集成开发环境 中 (IDE) ,但在 JDeveloper 中,可以达到最佳效 果 • 不需要 OLAP DML 编程经验 87 Copyright © 2005, Oracle. All rights reserved.
  • 88. BI Beans BI Beans 可以在下列 Oracle 产品中使用 : • Oracle Reports • Discoverer • Excel Add-in • Enterprise Planning and Budgeting 88 Copyright © 2005, Oracle. All rights reserved.
  • 89. BI Beans 应用程序构架 Forecasting Application Query Builder Bean Cross Tab Bean Graphic Bean Data Beans OLAP API Relational Views OLAP_TABLE Relational Multidimensional 89 Copyright © 2005, Oracle. All rights reserved.
  • 90. 使用 JDeveloper 和 BI Beans 建立一个客户化的分析应用
  • 92.
  • 93. BI Beans • 交互式的客户化分析应用。 • 可以构建一个“胖”客户端或“瘦”客户端。 • 制作的报表人员需要具备 OLAP DML 和 Java 编 程的相关知识。 93 Copyright © 2005, Oracle. All rights reserved.
  • 94. 相关工具介 绍 94 Copyright © 2005, Oracle. All rights reserved.
  • 95. Oracle 工具 使开发变得更为简单 • Warehouse Builder • Enterprise Manager • Analytic Workspace Manager • BI Beans 95 Copyright © 2005, Oracle. All rights reserved.
  • 96. Warehouse Builder • 提供设计环境 • 保存设计规范 • 将设计部署,以建立所有对象的空结构 • 加载数据 • 能够指定随后的数据加载和数据仓库维护的 方法 96 Copyright © 2005, Oracle. All rights reserved.
  • 97. Enterprise Manager • Oracle Enterprise Management 工具能够 定义并维护星型模型的元数据。 97 Copyright © 2005, Oracle. All rights reserved.
  • 98. AW Manager • 能够简单的根据现有的关系型模型,创建 AW 。 • 创建支持 OLAP 的所有对象。 • 能够浏览 AW 中的对象。 • 能够向 AW 添加 OLAP DML 代码。 • 能够指定随后的数据加载和数据仓库维护的 方法。 98 Copyright © 2005, Oracle. All rights reserved.
  • 99. BI Beans • 提供设计环境。 • 以 XML 格式存储设计规范。 • 设计可以被部署到不同的应用服务器中。 99 Copyright © 2005, Oracle. All rights reserved.
  • 100. 使用 Enterprise Manager 和 Analytic Workspace Manager 来构建 OLAP 数据仓库 100 Copyright © 2005, Oracle. All rights reserved.
  • 101. 建立 OLAP 数据仓库的步骤 利用 OEM  把源数据转化成为星型模型 (Star Schema)  定义星型模型的元数据 (metadata) < 完成这一步就得到了 ROLAP 模型 > 利用 AWM 6. 建立分析工作区 (Analytic Workspace, AW) 7. 定义映射到视图的元数据 ( 如果使用 OLAP API) < 现在你得到了 MOLAP 模型 > 101 Copyright © 2005, Oracle. All rights reserved.
  • 102. 建立 OLAP 数据仓库的步骤 Step 1 创建星型模型 (OWB 和运行 ETL) 102 Copyright © 2005, Oracle. All rights reserved.
  • 103. 建立 OLAP 数据仓库的步骤 OLAP Catalog Step 2 定义 ROLAP 模型的元数据 (OWB 和 Oracle Enterprise Manager) Step 1 设计星型模型 (OWB 和运行 ETL) 103 Copyright © 2005, Oracle. All rights reserved.
  • 104. 建立 OLAP 数据仓库的步骤 OLAP Catalog Step 2 定义 ROLAP 模型的元数据 (OWB 和 Oracle Enterprise Manager) Step 1 设计星型模型 (OWB 和运行 ETL) Step 3 构造 MOLAP 模型 (OWB 和 Analytic Workspace Manager) 104 Copyright © 2005, Oracle. All rights reserved.
  • 105. 建立 OLAP 数据仓库的步骤 OLAP Catalog Step 2 定义 ROLAP 模型的元数据 (OWB 和 Oracle Enterprise Manager) Step 1 设计星型模型 (OWB 和运行 ETL) Step 3 构造 MOLAP 模型 (OWB 和 Analytic Workspace Step 4 Manager) 汇总数据 (Analytic Workspace Manager) 105 Copyright © 2005, Oracle. All rights reserved.
  • 106. 练习环境介绍 OLAP Server –Oracle 10g 10.1.04 EE http://www.oracle.com/technology/software/products/ –Oracle 10.1.04 patch set –http://metalink.oracle.com OLAP Client –Oracle 10g Client http://www.oracle.com/technology/software/products/ –Analytic Workspace Manager 10.1.0.4 http://www.oracle.com/technology/products/bi/olap/olap.html –Oracle BI Spreadsheet Add-In http://www.oracle.com/technology/products/bi/spreadsheet_addin /index.html 106 Copyright © 2005, Oracle. All rights reserved.
  • 107. ROLAP 基于关系型结构,进行多维数据的表示和存储 通过在事实表和维表间建立主 / 外键,生成星 型和雪花模型 通过 OLAP API ,执行 SQL 来访问模型和进 行分析 107 Copyright © 2005, Oracle. All rights reserved.
  • 109. 维( Dimension ) 创建维表 – 级别关键字段,最低级别是主键 – 描述属性字段,每个级别至少一个 – 一般属性字段 – 其他约束,如非空检查 增加一个关系型维对象 – 将逻辑级别名和关键字段做映射 – 定义逻辑级别上的层次 – 对逻辑级别和属性字段做 1 对 1 的映射 – 定义雪花模型中的连接 增加 CWM 元数据 109 Copyright © 2005, Oracle. All rights reserved.
  • 110. 事实表( Fact ) 对每个维建立外键 至少一个度量字段 适当建立索引 110 Copyright © 2005, Oracle. All rights reserved.
  • 111. ROLAP 如果通过执行 SQL 可以满足分析需要,则可 以选择 ROLAP :  容易实施  通过 OLAP API 和 SQL 来访问  通过物化视图( Materialized View )来提高性能 111 Copyright © 2005, Oracle. All rights reserved.
  • 112. D E M O N S T R A T I O N 练习演示 123 112 Copyright © 2005, Oracle. All rights reserved.
  • 113. 在维上建 MV 提供物化的层次视图 每个层次上建一个 MV Region Product State City Sales Sales by CREATE Brand, City and Month Time 113 Copyright © 2005, Oracle. All rights reserved.
  • 114. 对维上的 MV 建索引 在每个级别关键字段上建位图索引( Bitmap Index ) Bitmap index A B C rows 1 0 114 Copyright © 2005, Oracle. All rights reserved.
  • 115. 10g 新功能 访问指导( Advisor ) – 通过分析访问工作量来建议 MV 分区变动跟踪和刷新 dbms_mview 包 – tune_mview 可以使 MV 刷新更快 115 Copyright © 2005, Oracle. All rights reserved.
  • 116. 常见问题 ROLAP 模型有 Bug – dbms_odm 包 重复的对象和字段名 不正确的结构 – MV 生成脚本过大 ( 超过 64K) – 太多的分区 – 临时表空间太少 116 Copyright © 2005, Oracle. All rights reserved.
  • 117. 问 题 • 在 ROLAP 模式中,维表的主键应该建在 哪个级别( LEVEL )上?  最低级别上 • 元数据资料库 (Metadata Repository) 统 称为什么? OLAP 对象类型是哪两个?  OLAP Catalog ,抽象数据类型 ( Abstract data types) 和表函数( Table function ) 117 Copyright © 2005, Oracle. All rights reserved.
  • 118. 软件 服务器 – 10.1.0.4 – Post-install 客户端 – awm 118 Copyright © 2005, Oracle. All rights reserved.
  • 119. MOLAP 如果业务需要使用 AW 所提供的扩展分析、预 测和计划功能时,就应该选择 MOLAP 的实现 方法。  能够通过使用 OLAP DML 来向 AW 加入分析功能  AW 存储在关系型表中  可以使用 BI Beans 或其它 SQL 客户端程序来访 问 AW 119 Copyright © 2005, Oracle. All rights reserved.
  • 120. 分析工作区( Analytic Workspace ) • Analytic Workspace 是一种多维数据 类型。 • 该数据类型包含了大量所存数据的描 述信息。 120 Copyright © 2005, Oracle. All rights reserved.
  • 121. 分析工作区( Analytic Workspace ) • 内嵌在 RDBMS 中的计算引擎,对 AW 中的数据进行操作 • 可以使用 OLAP DML 对 AW 中的对 象和数据进行操作 • OLAP_TABLE 表函数向 AW 发送 DML 命令 • 从 AW 中获得的查询结果发送到 OLAP_TABLE 121 Copyright © 2005, Oracle. All rights reserved.
  • 122. 分析工作区( Analytic While A Workspace ) Do B End Program Other source code information OLAP DML Data Hierarchy Formulas and relationships definitions equations Definitions for logical Dimension Measure groupings of data data data - CUBES - 122 Copyright © 2005, Oracle. All rights reserved.
  • 123. 9i 分析工作区 (Analytic Workspace) UID SEQ BLOB 对象 • AW 以二进制大 123 1 对象 (BLOB) 的方式存储在标 准关系型表中。 • AW 可以跨越行 。 123 2 123 Copyright © 2005, Oracle. All rights reserved.
  • 124. 124 Copyright © 2005, Oracle. All rights reserved.
  • 125. 分析工作区( Analytic Workspace ) 可以使用 Oracle OLAP Worksheet* 工具来浏览 Analytic Workspace 中的内容。 -> aw attach global 如果配置相 同,可以按 -> listnames 照左边范例 -> set colwidth 50;set lcolwidth 50; 输入相应的 -> report channel 命令。 -> fulldsc channel -> fulldsc cost_chg_pp * 可以在 AW Manager 中获得 OLAP Worksheet 工具 Awm.ico 125 Copyright © 2005, Oracle. All rights reserved.
  • 126. 分析工作区( Analytic Workspace ) 下列 Oracle 工具能够自动地 按照标准形式创建 AW 和它的对象: Warehouse Builder AW Manager DBMS_AWM APIs 126 Copyright © 2005, Oracle. All rights reserved.
  • 127. 将分析内容加入到 AW 中 OLAP DML 编程 可以使用 Oracle 工具来: • 创建 Analytic Workspace • 将对象加入 AW • 加载数据 通过使用 OLAP DML ,可以将客户 化对象加入到 Analytic Workspace. 127 Copyright © 2005, Oracle. All rights reserved.
  • 128. 将分析内容加入到 AW 中 OLAP DML 编程 // This is an OLAP DML program called CREATE_CALCULATION_FORMULA // Name and define the formula object DEFINE PROFIT FORMULA DECIMAL <CHANNEL CUSTOMER PRODUCT TIME> // Give it a long description LD 'Profit as defined by Sales less Cost' // Provide the arithmetic calculation EQ sales - extended_cost // Call a program to create a measure using this formula call create_measure_from_formula('formula_name=PROFIT cube_name=UNITS_CUBE display_name=Profit') 128 Copyright © 2005, Oracle. All rights reserved.
  • 129. AWM2 的特性 映射维度 存储 – 压缩组合 – 维度顺序 – 分区 – 规则 – 预汇总 – 缓存 129 Copyright © 2005, Oracle. All rights reserved.
  • 130. D E M O N S T R A T I O N 练习演示 130 Copyright © 2005, Oracle. All rights reserved.
  • 131.
  • 132.
  • 133. AWM2 的特性 映射维度 存储 – 压缩组合 – 维度顺序 – 分区 – 规则 – 预汇总 – 缓存 133 Copyright © 2005, Oracle. All rights reserved.
  • 134. 压缩组合( Compressed Composite ) 一般的组合包括: – 所有的叶结点的值 – 所有预计算的合计值 – 所有合计值 如果数据是稀疏的,那么 很多合计可能只对一个值 来做,也就是说很多合计 的值是相同的。 134 Copyright © 2005, Oracle. All rights reserved.
  • 135. 压缩组合( Compressed Composite ) 自动压缩 对重复值只存储一次 减少所占磁盘和内存空间 提高合计速度 135 Copyright © 2005, Oracle. All rights reserved.
  • 136. 何时使用压缩组合? 使用压缩组合的条件 – 用 SUM 或 NOAGG 方法 – 数据稀疏 时间维: – 如果到月或更高级别,不使用 – 如果到日,可以使用 – 如果到周,可以试试 136 Copyright © 2005, Oracle. All rights reserved.
  • 138. 维度顺序 对于压缩组合 : – 密集维必须在压缩组合的维度前 – 压缩组合中的维度可任意排列 对于正常组合 : – 维度由大到小排列 138 Copyright © 2005, Oracle. All rights reserved.
  • 139. 分区
  • 140. 分区 分区可以将立方体再分成更小的存储部分,每 部分都有自己的组合 控制组合和变量的大小 – 可以全部加载到内存中,这样计算会快 可以并行地加载和计算数据 分区所在级别以下各级会自动预计算 140 Copyright © 2005, Oracle. All rights reserved.
  • 141. 规则
  • 142. 规则 压缩组合时,只有 SUM 和 NOAGG 方法可 以使用 非压缩组合时,可以用所有的计算方法 可以选择层次进行计算 142 Copyright © 2005, Oracle. All rights reserved.
  • 144. 预汇总 如果是压缩组合,全部做预汇总 否则选择级别做预汇总 – 基于以下规则 : 希望在哪个级别提高查询响应速度 ; 平衡每个级别下的“孩子”数; 144 Copyright © 2005, Oracle. All rights reserved.
  • 145. 缓存 动态汇总的值可以记录在缓存中 缓存的值不会随数据的改变而自动刷新 适用于只读型应用 145 Copyright © 2005, Oracle. All rights reserved.
  • 146. 大数据量处理 多种物理存储模式 MULTI 访问方式 分区 并行 RAC 和网格计算 146 Copyright © 2005, Oracle. All rights reserved.
  • 147. 9i Release 2 存储模式 AW$ 表 SALES SALESAW$ Table Oracle Data File AW$SALES SQL> desc aw$sales Name Null? Type ------------------ -------- ------------ XTNUM NUMBER(8) AWLOB BLOB 147 Copyright © 2005, Oracle. All rights reserved.
  • 148. 9i Release 2 存储模式 AW$ 表 AW$SALES Oracle Data File 0 – 20 GB SALES 20 – 40 GB 40 – 60 GB 60 – 80 GB 80 – 100 GB 通过增加新的记录来满足数据扩展 148 Copyright © 2005, Oracle. All rights reserved.
  • 149. 9i Release 2 存储模式 AW$ 表分区 AW$SALES Oracle Data Files 0 – 20 GB SALES 20 – 40 GB 40 – 60 GB 60 – 80 GB 80 – 100 GB 通过表分区的方法,对 AW$ 表进行分区 149 Copyright © 2005, Oracle. All rights reserved.
  • 150. Oracle10g 存储模式 AW$SALES Oracle Data Files SALES UNITS COST FORECAST_SALES SALES FORECAST_UNITS 分析工作区( AW )中的对象分别存储在不同记录中 150 Copyright © 2005, Oracle. All rights reserved.
  • 151. Oracle10g 存储模式 AW$SALES Oracle Data Files SALES UNITS COST FORECAST_SALES SALES FORECAST_UNITS 通过表分区的方法,对 AW$ 表进行分区 151 Copyright © 2005, Oracle. All rights reserved.
  • 152. MULTI 访问方式 9i Release 2 访问方式 – Read only 没有对分析工作区( AW )加锁 – Read write 对分析工作区( AW )加锁,进行写操作 – Read write exclusive 对分析工作区( AW )加锁,进行读和写操作 152 Copyright © 2005, Oracle. All rights reserved.
  • 153. MULTI 访问方式 10g MULTI 访问方式 – 允许在多个会话中,对 AW 进行读 - 写操作 – 允许对 AW 中的对象分别进行写操作 153 Copyright © 2005, Oracle. All rights reserved.
  • 154. MULTI 访问方式 AW ATTACH sales MULTI AW ATTACH sales MULTI ACQUIRE actual_sales ACQUIRE forecast_sales Load new sales data Run forecasts UPDATE MULTI sales UPDATE MULTI sales COMMIT COMMIT RELEASE actual_sales RELEASE forecast_sales 154 Copyright © 2005, Oracle. All rights reserved.
  • 155. MULTI 访问方式 通过不同的会话同时进行: – 并行数据加载 – 汇总 – 分配 – 预测 – …… 155 Copyright © 2005, Oracle. All rights reserved.
  • 156. 分区 对 AW 中的对象进行分区 每个分区作为一条记录存在 AW$ 表中 分区类型 – RANGE – LIST – CONCAT 156 Copyright © 2005, Oracle. All rights reserved.
  • 157. 分区 RANGE 分区 – 根据维值的范围分区 Customers less than 1000 Customers less than 2000 Sales Customers less than 3000 Customers less than 4000 Customers less than 5000 157 Copyright © 2005, Oracle. All rights reserved.
  • 158. 分区 LIST 分区 – 根据维值的列表分区 <‘JAN03’,’FEB03’,’MAR03’> <‘APR03’,’MAY03’,’JUN03’> Sales <‘JUL03’,’AUG03’,SEP03’> <‘OCT03’,’NOV03’,’DEC03’> <‘JAN04’,’FEB04’,’MAR04’> 158 Copyright © 2005, Oracle. All rights reserved.
  • 159. 分区 CONCAT 分区 – 根据 CONCAT 维中的基维分区 TIME2000 dimension 什么是 CONCAT 维 TIME2001 dimension ? Sales TIME2002 dimension TIME2003 dimension TIME2004 dimension 159 Copyright © 2005, Oracle. All rights reserved.
  • 160. 分区 CONCAT 维 – 由多个物理维组成的一个逻辑维 TIME2000 dimension TIME2001 dimension TIME TIME2002 dimension TIME2003 dimension TIME2004 dimension 160 Copyright © 2005, Oracle. All rights reserved.
  • 161. 分区 SALES Y2001 partition SALES SALES Y2002 partition SALES Y2002 partition SALES 作为一个单一变量被访问 161 Copyright © 2005, Oracle. All rights reserved.
  • 162. D E M O N S T R A T I O N 动手练习 162 Copyright © 2005, Oracle. All rights reserved.
  • 163. 问 题 • AW 以什么方式存储在关系型表中?  二进制大对象 (BLOB) • 通过使用什么语言,可以将客户化对象加 入到 AW 中?  OLAP DML 163 Copyright © 2005, Oracle. All rights reserved.
  • 164. D E M O N S T R A T I O N EXCEL 访问 演示 164 Copyright © 2005, Oracle. All rights reserved.
  • 165. 集成的 RDBMS- MDDS – 单一 RDBMS-MDDS 进程 – 单一数据存储 – 单一的管理工具 – 单一的安全角色 – 单一的 API 及 SQL 访问 – 利用关系数据库的成熟技术(备份,可靠性,安全性等等) 165 Copyright © 2005, Oracle. All rights reserved.
  • 166. 测试案例 使用已有 OSA 应用 14 个度量 时间维 — 周、月、年 (260) 产品维 (4,220 ), 客户维 (7,804) 和销售渠道维 (22) 在产品维和客户维上层次很多 2 百 90 万条记录 在 6G 内存的服务器上运行 – 运行 616 分钟 – 所占磁盘空间 100GB 166 Copyright © 2005, Oracle. All rights reserved.
  • 167. 测试案例( AWM10g ) 使用单 CPU 、 2G 内存服务器 所有维度组成一个压缩组合 在时间维的年度级别上建分区 运行 51 分钟,所占磁盘空间 1.6GB 比原来快 12 倍,存储空间只有 1/60 167 Copyright © 2005, Oracle. All rights reserved.
  • 168. ORACLE OLAP 继承了 DB 的特性  高度的安全性 1 Node 2 Nodes 3 Nodes 4 Nodes  网格和 RAC 技术 Concurrent Users 1,250 2,500 3,750 5,000  并行计算和分区 Total Queries per Second 210 412 624 812  大量的数据计算 6,000 5,000 4,000 Concurrent Users 3,000 Total Queries per Second 2,000 1,000 0 1 Node 2 Nodes 3 Nodes 4 Nodes 168 Copyright © 2005, Oracle. All rights reserved.
  • 169. 抽象数据类型实例 (ADT) ... 1. 创建 ADT 记录对象 create type time_type_row as object ( month varchar(10), month_label varchar(6), quarter varchar(3), quarter_label varchar(8), year varchar(3), year_label varchar(5)); 2. 创建表对象 create type time_type_table as table of time_type_row ; 抽象数据类型提供了一种方法,把非关系型数据映射到关 系型的数据格式 169 Copyright © 2005, Oracle. All rights reserved.
  • 170. 表函数技术 实例 … 将表函数的定义嵌在关系型视图的定义中: create or replace view time_view as select * from table(OLAP_TABLE(‘production.sales DURATION query', 'TIME_TYPE_TABLE', 'limit time to levelrel.time ''month''', 'DIMENSION month FROM time MEASURE month_label FROM name.time MEASURE quarter FROM time.qtr MEASURE quarter_label FROM time.qtr.name MEASURE year FROM time.year MEASURE year_label FROM time.year.name' )); 170 Copyright © 2005, Oracle. All rights reserved.
  • 171. Oracle 商务智能 Oracle Enterprise Oracle Oracle Oracle Oracle Excel Oracle Planning & Discoverer HTML DB Reports Discoverer Add-In BI Beans Budgeting OLAP Database OLAP Option: Query Analysis Planning Oracle Warehouse Builder Analytic Workspace Manager
  • 172. OLAP 平台 Oracle Excel Oracle EPB 客户应用 第三方工具 第三方应用 Add-In Discoverer Business Intelligence Beans OLAP API SQL Database OLAP Option: Query Analysis Planning Oracle Warehouse Builder
  • 173. Oracle OLAP 的结构 BI Beans, Reports, Discoverer, Excel-AddIn OLAP API R-OLAP M-OLAP SQL (OLAP DML) (SQL) Oracle Database Anyalytic Workspaces (AW) OLAP DML SQL Objets Relation OLAP & (Tables, Materialized Views) Catalog Objets Multidimension SQL (Cubes, Dimensions) 预测 计划 Data Warehouse What-If 分析 计算 173 Copyright © 2005, Oracle. All rights reserved.
  • 174. 构建 OLAP 数据仓库 开始决策分析 使用 Enterprise Manager 和 AW Manager 的流程 OLAP Catalog Dimension OLAP Dimension Catalog View Cube over Dimension the Dimension Dimension AW Dimension Cube Cube 1. 2. 3. 4. 5. 6. 创建 使用 使用 AW Manager AW Manager 使用 Discoverer 星型模型 Enterprise Analytic 会自动地 会自动地 Plus OLAP Manager Workspace 在 AW 中 将多维元数 或其他 SQL 工具 定义多维元数据 Manager 创建视图 添加到 查阅 并添加至 创建 AW OLAP Catalog AW 中的数据 OLAP Catalog 并添加 分析性内容 174 Copyright © 2005, Oracle. All rights reserved.
  • 175. 开始决策分析 构建 OLAP 数据仓库 使用 OWB (Paris) 的流程 OLAP Catalog Dimension OLAP Dimension Catalog View Cube over Dimension the Dimension Dimension AW Dimension Cube Cube 1. 2. 3. 4. 5. 6. 使用 Warehouse 使用 使用 Warehouse Warehouse 使用 Discoverer Builder Warehouse Warehouse Builder Builder Plus OLAP 把数据 Builder Builder 会自动地 会自动地向 或其他 SQL 工具 从不同的系统 把多维元数据 创建一个 AW 在 AW 中 OLAP Catalog 查阅 转换加载到 定义到 并加入 根据所需的 加入 AW 中的数据 星型模型中 OLAP Catalog 中 分析性内容 ADT 多维元数据 创建视图 175 Copyright © 2005, Oracle. All rights reserved.
  • 176.
  • 177. Q & QUESTIONS 177 A ANSWERS Copyright © 2005, Oracle. All rights reserved.

Notas del editor

  1. <number>
  2. <number>
  3. <number>
  4. <number>
  5. <number>
  6. <number>
  7. <number>
  8. A look at the major components to the 9i next as it relates to OLAP.Starting at the bottom, note that all data is stored in Oracle data files – both relational and multidimensional. In the case of multidimensional, data is stored in an analytic workspace within a relational schema. An analytic workspace is the moral equivalent to an Express database. That is, it’s a self contained MD schema just like an Express database. The AW contains everything an Express DB contains … dimensions, variables, formulas, valuesets, etc. It stores data the same way as Express (e.g., variable by dimensions or composites), uses about the same amount of disk, etc. Unlike Express, it is managed by Oracle, so it’s safe and secure (e.g., backup and recovery).As with any other release of the Oracle database there are, of course, relational objects in the database. Obviously no change with 9i next, although it’s worthwhile to note that analytic workspaces and relational objects can happily coexist in the same schema.From the OLAP perspective, there are three technologies that are make up the server. The relational engine provides SQL and manages relational objects. The object technology provides the means for multidimensional data to be presented to the relational engine (this occurs through table functions). The multidimensional engine provides support for the OLAP DML (Express SPL renamed) and management of multidimensional objects. This is the same great multidimensional engine as Express (with enhancements, of course), except that it’s rehosted in the Oracle database.Applications can connect using the OLAP API, OCI or JDBC. In the case of connecting via the OLAP API, the OLAP API connects to the database using JDBC. As we will see in later slides, applications connect to the database using any of these methods and access both relational and multidimensional objects.
  9. All OLAP option metadata is stored in the OLAP Catalog. There are three types of metadata:The logical dimensional model which includes:Dimensions (including levels, hierarchies, and attributes). The OLAP Catalog dimension object is consistent with the Oracle RDBMS dimension object, but it contains additional metadata.Cubes, which include measures. When a relational table is the source to a cube, the cube specifies the relationship between dimensions and fact tables and thus completes the definition of the star schema.Measure folders contain one or more measures from any number of cubes and provide a convenient way to group measures together by subject matter.The OLAP Catalog is the OLAP APIs source of metadata and thus it must be maintained if you are using the OLAP API. The OLAP Catalog is also the source of metadata for utilities such as Analytic Workspace Manager PL/SQL package that can be used to build analytic workspaces from star schemas. The OLAP Catalog can be managed by Oracle Enterprise Manager when the source of the cube is a relational table. The OLAP Catalog CWM2 packages can be used to manage the OLAP catalog when cubes are mapped to either relational tables or analytic workspaces. Note that there isn’t any metadata stored in analytic workspaces – the OLAP Catalog is the source of all metadata. Some applications might choose to build some metadata in the analytic workspace (that is, some OEO or OSA like metadata). That’s fine, but the official metadata is the OLAP Catalog.
  10. This is an example of select data directly from an table function. Notice that this table function includes an OLAP DML command, FORECAST_SALES, that runs a forecast.
  11. Table function technology:It is the Object technology that provides a way to extract data from a multidimensional storage format and represent it in a relational table format. Specifically, it is the Table function, OLAP_TABLE that provides this functionality. The table function manages the physical movement of the data from the AW to a relational view.
  12. Now we’ll take a look at the four major methods of querying analytic workspaces. But first, remember that the OLAP option can query relational tables directly without the use of analytic workspaces.The major components of AW through SQL are:The analytic workspace itself. This is were the data is.The MD engine (not shown). This provides that calculation capability.Abstract data types are part of the database’s object technology. They are used to describe the output of a table function The OLAP_TABLE table function. This is the piece of software that provides the SQL interface to the MD engine and analytic workspace. OLAP_TABLE attaches analytic workspaces, can call OLAP DML commands, maps ADTs to analytic workspace objects and returns data to the relational engine.Now the query methods:Applications that use the OLAP API issue OLAP API calls to the OLAP option. The OLAP option’s SQL generator creates SQL against the relational view. The relational view is defined over a table function OLAP_TABLE and OLAP_TABLE gets data from the analytic workspace.It might seem interesting that the OLAP API accesses data through the RDBMS engine (the view) rather than accessing the MD engine directly. Surely it would be faster to go directly to the OLAP engine directly rather than through the relational engine? While it might be a little faster, the amount of time spent using OLAP_TABLE is small little as to be irrelevant (e.g., <.02 seconds). That speaks volumes about the efficiency of OLAP_TABLE.By using SQL, we can a few advantages. First, it makes sure that you always get the same results regardless of whether you source data in relational tables or analytic workspaces. Second, it provides the means for the OLAP API to join both relational and analytic workspace data in the same query (like any other application, the OLAP API doesn’t even need to know that an analytic workspace is behind the view – it just looks like a relational view). Finally, it minimizes the code paths in the software which generally leads to faster and more stable software and better engineering efficiency (which leaves more time for new feature development).‘Generic’ SQL applications can select data directly from relational views. Again, the relational views look just like any other relational data type in the database so SQL applications work ‘as is’ against relational views serviced by analytic workspaces.SQL applications can choose to be ‘OLAP aware’ by writing queries directly to the table function. By doing so, applications can send OLAP DML commands to the MD engine. For example, the application might want to limit the data that is returned, install a calculation, run a forecast or perform a product ranking. Although the OLAP DML might be used to limit the view of data or to perform a calculation, the data is returned to the relational engine (just like any other view). This allows SQL based applications to make incremental changes to their SQL generators while accessing the power of the multidimensional engine.Finally, applications can issue commands directly against against the multidimensional engine without using OLAP_TABLE. In this case, the PL/SQL package DBMS_AW.EXECUTE is used to send commands to the multidimensional engine. You can send any OLAP DML command you want via a OCI or JDBC connection (load data, aggregate data, solve a model, define a formula, etc.). If you’ve written to Express’ SNAPI API, you can think of OCI or JDBC and DBMS_AW.EXECUTE as being the replacement to SPAPI and its’ SN.EXECUTE command.Two other PL/SQL packages, DBMS_AW.INTERP and DBMS_AW.INTERPCLOB provide the means to return data from analytic workspaces to PL/SQL programs.
  13. MS ExcelOracle Reports, Crystal Reports, Visual Basic, PowerBuilder etc.Oracle Discoverer, Brio, Business Object, MicroStrategy etc.BI Beans, Cognus PowerPlay, Pro Clarity etc
  14. MS ExcelOracle Reports, Crystal Reports, Visual Basic, PowerBuilder etc.Oracle Discoverer, Brio, Business Object, MicroStrategy etc.BI Beans, Cognus PowerPlay, Pro Clarity etc
  15. The OLAP Data Management package, DBMS_ODM, provides procedures for creating materialized views specific to the requirements of the OLAP API.
  16. Tuple -- 元组,数组In a relational data base, a part of a relation that identifiers an entity and its attributes.关系数据库中,标识一个实体及其属性的关系的一部分。
  17. Values above the partition level in a hierarchy are calculated dynamically.E.g., if partition on time at the quarter level, year totals are calculated on the fly.Higher level for partitioning (e.g., year):More presummarizationbetter query performanceFewer partitionsless opportunity for parallelizationlarger composites.Less granular rolloff of unused partitionsLower level for partitioning (e.g., month)Less presummarizationpoorer query performanceMore partitionsmore opportunity for parallelizationSmaller compositesMore granular rolloff of unused partitions