Datové sklady

27
Datové sklady Cvičení 1 RNDr. David Žák, Ph.D. [email protected]

description

Datové sklady. Cvičení 1 RNDr. David Žák, Ph.D. [email protected]. Požadavky na studenta. Podmínkou udělení zápočtu je odevzdání všech prací řešených na cvičeních účast na min im álně 70 % cvičení a úspěšné absolvování zápočtového testu nebo odevzdání zápočtové práce. - PowerPoint PPT Presentation

Transcript of Datové sklady

Page 1: Datové sklady

Datové sklady

Cvičení 1

RNDr. David Žák, [email protected]

Page 2: Datové sklady

Požadavky na studenta

• Podmínkou udělení zápočtu je – odevzdání všech prací řešených na cvičeních – účast na minimálně 70% cvičení– a úspěšné absolvování zápočtového testu nebo odevzdání

zápočtové práce.

Datové sklady - cv. 1 2

Page 3: Datové sklady

Charakteristiky dat v systémech

Data provozních ISData pro podporu

rozhodování

Aplikačně orientovaná Subjektově orientovaná

Detailní Souhrnná (sumarizovaná)

Aktuální Historická

Pro běžné uživatele Pro management

Aktualizovatelná Pouze pro čtení

Normalizovaná Redundantní

Datové sklady - cv. 1 3

Page 4: Datové sklady

Charakteristiky dat v systémech

Datové sklady - cv. 1 4

Page 5: Datové sklady

Charakteristiky dat v systémech

Datové sklady - cv. 1 5

Page 6: Datové sklady

Schéma technologie EDW

Datové sklady - cv. 1 6

Page 7: Datové sklady

Charakteristiky dat v systémech

Struktura datového modelu (schéma) EDW obsahuje dva druhy tabulek, alespoň jednu tabulku faktů a dále tabulky dimenzionální.

• Tabulka faktů obsahuje měřitelné (vyčíslitelné) údaje o sledovaném subjektu (například výdaj, příjem, cena, plat, apod.).

• Dimenzionální tabulky jsou číselníky, umožňující výběr, třídění a filtraci dat uložených v tabulce faktů.

Datové sklady - cv. 1 7

Page 8: Datové sklady

Schéma typu hvězda

Datové sklady - cv. 1 8

Page 9: Datové sklady

Schéma typu sněhová vločka

Datové sklady - cv. 1 9

Page 10: Datové sklady

Multidimenzionální datová kostka

Datové sklady - cv. 1 10

Page 11: Datové sklady

OLAP analýza

Pojem OLAP (On Line Analytical Processing) zaveden Dr. E.F.Coddem

„Volně definovaná řada principů, které poskytují dimenzionální rámec pro podporu rozhodování.“

Datové sklady - cv. 1 11

Page 12: Datové sklady

Vzorové schéma SH

The sample company does a high volume of business, so it runs business statistics reports to aid in decision making. Many of these reports are time-based and nonvolatile. That is, they analyze past data trends. The company loads data into its data warehouse regularly to gather statistics for these reports. These reports include annual, quarterly, monthly, and weekly sales figures by product. These reports are stored with the help of Sales History (SH) schema.The company also runs reports on distribution channels through which its sales are delivered. When the company runs special promotions on its products, it analyzes the impact of the promotions on sales. It also analyzes sales by geographical area.

Datové sklady - cv. 1 12

Page 13: Datové sklady

Vzorové schéma SH

(sales history)

Datové sklady - cv. 1 13

Page 14: Datové sklady

Postup řešení

• Seznámení s– schématem SH (Sales History) – nástrojem Enterprise Manager (zobrazení existujících

objektů – dimenzí, kostek)– Návrh datového skladu– Vytváření dimenzí a kostek– SQL dotazy pro agregaci a analýzu dat

Datové sklady - cv. 1 14

Page 15: Datové sklady

Postup řešení

• Jméno serveru: fei-sql1.upceucebny.cz• SID: ee11• Username: vaše_doménové_jméno (např. ST12345)• Password: (Hesla jsou tvořena spojením posledních dvou číslic z netId

a číslem stagId – zadávat s malým písmenem i)

• Port: 1521

• Změna hesla: ALTER USER ST12345 IDENTIFIED BY nove_heslo

Datové sklady - cv. 1 15

Page 16: Datové sklady

Postup řešení

• jméno serveru: SQL101.upceucebny.cz• service name / connect string: atdstest• username: sh• password: ústně• port: 1521

Upozornění – všichni pracují nad stejným schématem, neměňte data ve schématu.

Datové sklady - cv. 1 16

Page 17: Datové sklady

Oracle – pojmy• Fact Tables• A fact table typically has two types of columns: those that contain

numeric facts (often called measurements), and those that are foreign keys to dimension tables. A fact table contains either detail-level facts or facts that have been aggregated. Fact tables that contain aggregated facts are often called summary tables. A fact table usually contains facts with the same level of aggregation.

• Though most facts are additive, they can also be semi-additive or non-additive. Additive facts can be aggregated by simple arithmetical addition. A common example of this is sales. Non-additive facts cannot be added at all. An example of this is averages. Semi-additive facts can be aggregated along some of the dimensions and not along others. An example of this is inventory levels, where you cannot tell what a level means simply by looking at it.

Datové sklady - cv. 1 17

Page 18: Datové sklady

Oracle – pojmy• Dimension Tables• A dimension is a structure, often composed of one or more hierarchies,

that categorizes data. Dimensional attributes help to describe the dimensional value. They are normally descriptive, textual values. Several distinct dimensions, combined with facts, enable you to answer business questions. Commonly used dimensions are customers, products, and time.

• Dimension data is typically collected at the lowest level of detail and then aggregated into higher level totals that are more useful for analysis. These natural rollups or aggregations within a dimension table are called hierarchies.

Datové sklady - cv. 1 18

Page 19: Datové sklady

Oracle – pojmy• Hierarchies• Hierarchies are logical structures that use ordered levels as a means of

organizing data. A hierarchy can be used to define data aggregation. For example, in a time dimension, a hierarchy might aggregate data from the month level to the quarter level to the year level. A hierarchy can also be used to define a navigational drill path and to establish a family structure.

• Within a hierarchy, each level is logically connected to the levels above and below it. Data values at lower levels aggregate into the data values at higher levels. A dimension can be composed of more than one hierarchy. For example, in the product dimension, there might be two hierarchies—one for product categories and one for product suppliers.

Datové sklady - cv. 1 19

Page 20: Datové sklady

Oracle – pojmy• Levels• A level represents a position in a hierarchy. For example, a time dimension

might have a hierarchy that represents data at the month, quarter, and year levels. Levels range from general to specific, with the root level as the highest or most general level. The levels in a dimension are organized into one or more hierarchies.

• Level Relationships• Level relationships specify top-to-bottom ordering of levels from most

general (the root) to most specific information. They define the parent-child relationship between the levels in a hierarchy.

• Hierarchies are also essential components in enabling more complex rewrites. For example, the database can aggregate an existing sales revenue on a quarterly base to a yearly aggregation when the dimensional dependencies between quarter and year are known.

Datové sklady - cv. 1 20

Page 21: Datové sklady

Oracle – pojmy• Příklad hierarchie

Datové sklady - cv. 1 21

Page 22: Datové sklady

Oracle – pojmy• Příklad objektů datového skladu

Datové sklady - cv. 1 22

Page 23: Datové sklady

Oracle – pojmy• Příklad objektů datového skladu

Datové sklady - cv. 1 23

Page 24: Datové sklady

Úkoly

1. Připojte se k dtb. serveru FEI_SQL1Prostřednictvím SQL developeru

1. Seznamte se s průvodcem vytvoření datového skladu na http://docs.oracle.com/cd/E11882_01/server.112/e25554/toc.htm#

2. Seznamte se s pojmy – tabulka faktů, dimensí, hierarchie, kostka a jak je to implementováno ve vzorovém schématu SH

Datové sklady - cv. 1 24

Page 25: Datové sklady

Úkoly – odevzdat

5. Fyzický návrh datového skladu - viz kapitola 3,Partitioned Tables – viz kapitola 5 (a následně

http://docs.oracle.com/cd/E11882_01/server.112/e25523/toc.htm

Materialized Views – viz kapitola 9,10 (základy)

Dimensions – viz kapitola 11 (důležité)

U všech těchto pojmů vysvětlete v dokumentu s názvem Prijmeni_Jmeno_DS_CV1 jejich smysl (máte přeci za sebou studium architektur DS), základní syntaxi, každému pojmu věnujte zhruba 2-3 strany dokumentu).

Datové sklady - cv. 1 25

Page 26: Datové sklady

Úkoly – odevzdat

6. Na základě schématu SH popište jednu– Partitioned table– Materialized View– Dimenzi

Popis bude obsahovat SQL příkaz pro vytvoření, seznámení s obsahem těchto objektů, jeho organizací, atd. Každému z uvedených objektů věnujte minimálně 1 stranu dokumentu o velikosti A4.

Dokument odevzdejte nejpozději 1 den před dalším cvičením na STAG (odevzdávání prací), tj. do 18.3.2012.

Datové sklady - cv. 1 26

Page 27: Datové sklady

Děkuji za pozornost.

Datové sklady - cv. 1 27