loading the data warehouse (chapter10) data warehousing lab. semester 2 hyunsuk jung

19
Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Data Warehousing Lab. Semester 2 HyunSuk Jung Semester 2 HyunSuk Jung

Upload: calvin-miller

Post on 18-Jan-2016

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

Loading the Data Warehouse(Chapter10)

Data Warehousing Lab.Data Warehousing Lab.

Semester 2 HyunSuk JungSemester 2 HyunSuk Jung

Page 2: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

2Data Warehousing

Lab.DW

Import

Reflexive partner to Export.Reflexive partner to Export. Export: to copy Oracle data to a compressed binary file readable only by

Oracle.

Import: to copy data from that file back into one or more Oracle tables

Reads only files created by Export.Reads only files created by Export.

Backup strategy used by most Oracle installations.Backup strategy used by most Oracle installations.

Migration strategy : from operational systems into the Oracle data Migration strategy : from operational systems into the Oracle data warehousewarehouse

Page 3: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

3Data Warehousing

Lab.DW

Modes of Operation

The owner of the tables in the source databaseThe owner of the tables in the source database

Tables belonging to more than one userTables belonging to more than one user

If the imported tables do not already existIf the imported tables do not already exist

ModeMode DetailsDetails

Full Database Exports and imports the complete database. This includes all data, structure definitions, and the files that support the database.

User Exports and imports the data and corresponding data definitions for one or more users.

Table Exports and imports the data and corresponding data definitions for one or more tables, belonging to one ore more owners.

Page 4: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

4Data Warehousing

Lab.DW

Parameters Fed to Import

Parameter

DetailsDetails DefaultDefault

Ignore Import 중 create 명령을 실행할 때 만나게 되는 에러들을 무시할 것인지 결정 (Y/N 플래그 )

N

Commit 배열 단위로 commit 을 할 것인가를 결정 . 기본적으로 테이블 단위로 commit 한다 . 배열의 크기는 buffer 에 의해 설정된다 .

N

Fromuser EXPORT 덤프 파일로부터 읽혀져야 하는 객체들을 갖고 있는 데이터베이스 계정

None

Touser EXPORT 덤프 안에 있는 객체들이 IMPORT 될 데이터베이스 계정

None

Full FULL EXPORT 덤프 파일이 IMPORT 할때 사용한다 .

Page 5: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

5Data Warehousing

Lab.DW

Five parameter 설명 The Ignore Parameter The Ignore Parameter

Imp userid=account/account full=y file=account ignore=y

The Commit ParameterThe Commit Parameter “save”

Imp userid=account/account full=y file=account ignore=y commit=y

Fromuser, Touser, and Full ParametersFromuser, Touser, and Full Parameters Must be coded on the call to Import

Page 6: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

6Data Warehousing

Lab.DW

Import 예제 예제예제 1) 1) 전체 전체 databasedatabase 가 가 importimport 된다된다 . (Full Level). (Full Level)

imp userid=system/manager file=‘C:\full.dmp’ full=y

예제예제 2) Scott2) Scott 의 의 user importuser import 를 실행한다를 실행한다 . (User Level). (User Level)

imp userid=scott/tiger file=‘C:\scott.dmp’

예제예제 3) 3) 다른 계정으로 다른 계정으로 IMPORTIMPORT 하기하기 ..

scott user 의 데이터를 export 해서 test user 에게 import 하는 예제

exp userid=system/manager file=‘C:\scott.dmp’ owner=scott

imp userid=system/manager file=‘C:\scott.dmp’ fromuser=scott touser=test

Page 7: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

7Data Warehousing

Lab.DW

PL/SQL Approach

오라클 자체에 내장되어 있는 프로시져 언어 블록 구조를 갖는다 . <BEGIN~END 사이에 명령을 한꺼번에 서버에

제공해서 한꺼번에 수행하므로 그 속도가 빠르다 .> SQL 문을 지원하는 제어문 , 반복문 등을 지원한다 . PL/SQL 은 그 자신의 컴파일 엔진을 가지고 있다 . 목적 : SQL 문을 블록단위로 처리하므로 network 상에서의

처리속도를 향상시킨다 . 지원하는 TOOL : ORACLE

FORMS,DEVELOPER/2000,SQL*plus. Powerful and very flexible tool

Part of the data warehouse transformation solution

Page 8: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

8Data Warehousing

Lab.DW

PL/SQL Approach

Modularization : stand-alone program

Creating routine Data reading

Data validation

Data creation

Business rules

Data parsing

Data transform

Data loading

Page 9: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

9Data Warehousing

Lab.DW

UTL_FILE

Utl_file package 를 사용함으로써 일반 file 에 대한 input/output 을 수행할 수 있다 .

Limitations A maximum string length of 1KB Maximum of ten files open simultaneously. Files must be placed in directories identified in the init.ora parameter of

utl_file_directory.

Logical series of steps to load data into the data warehouse1. Open datafile for reading

2. Loop through each file record

3. Parse record

4. Transform and load data into the warehouse

5. Verify load status

6. Close data file

7. Return status to the user

Page 10: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

10Data Warehousing

Lab.DW

Dynamic SQL

Dynamic SQL Steps in a Program

1. Open cursor (open_cursor)

2. Parse statement (parse)

3. Bind input variables (bind_variable)

4. Execute statement (execute)

5. Retrieve values of output variables (retrieve_variable)

6. Close cursor (close_cursor)

With Oracle8i

dbms_sql.parse(l_cursor_id, l_sql, dbms_sql.native);

l_lows:= dbms_sql.execute(l_cursor_id);

dbms_sql.close_cursor(l_cursor_id);

execute immediate l_sql;

Page 11: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

11Data Warehousing

Lab.DW

Dynamic SQL

Why you would want to use Dynamic SQL? Table-driven loading structure

Changes to physical environment (new tables added each month)

Increase modularity of code : 프로그램의 재사용성 (reusability) 을 증가시킬 수 있다 . “It’s really good”

Page 12: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

12Data Warehousing

Lab.DW

OWB(Oracle Warehouse Builder)

OWBOWB 란란 ?? 기업 데이터 웨어하우스 , 데이터 마트 및 e-Business 애플리케이션을

디자인 , 구현 및 관리하기 위한 도구 Oracle9i Developer 제품군에 포함되어 있다 .

Page 13: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

13Data Warehousing

Lab.DW

OWB 기본 기능 Metadata 중심의 source 정의

metadata source 를 OWD 의 repository 로 import

<OWB Import Metadata wizard>

Page 14: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

14Data Warehousing

Lab.DW

OWB 기본 기능 Graphical mapping and transformation designGraphical mapping and transformation design

high-level mapping : source table 을 target table 로 mapping

Page 15: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

15Data Warehousing

Lab.DW

OWB 기본 기능

detailed-level mapping : transformation 시 수행되는 칼럼과 칼럼간의 mapping

변환 library 통해 PL/SQL 로 모듈 생성 후 재사용 가능

변환 시 필요한 경우 customize 할 수 있음

<Data element mapping>

Page 16: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

16Data Warehousing

Lab.DW

장점 (1/2) 신속한 신속한 DW DW 설계설계

OWB 의 visual model, wizard 중심의 GUI 사전 정의된 변환 라이브러리

에러 없는 코드 작성에러 없는 코드 작성 DW 개발 이전에 객체 , 매핑 , 변환 등을 확인 생성된 객체 : Foreign, Unique, Primary Key 를 지닌 table view,

구체화된 view, fact, dimension, hierarchy, level, index, partition, table 공간 등이 포함

Page 17: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

17Data Warehousing

Lab.DW

장점 (2/2) 신속하고 정확한 데이터 로딩신속하고 정확한 데이터 로딩

Oracle8i 를 데이터 로딩을 제공하는 변환 엔진으로 사용 wizard 중심의 interface : 기본 및 direct path loader 를 통해 flat file

로부터 데이터를 로딩하기 위한 제어 파일을 생성

중앙 집중화된 메타데이타 관리중앙 집중화된 메타데이타 관리 CWM(Common Warehouse Model) 을 통해 메타데이타를 수집 , 배포

애플리케이션 통합애플리케이션 통합 Oracle Application 11i e-Business Intelligence 가 사전 패키지화된

DW 제공

Page 18: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

18Data Warehousing

Lab.DW

ETL Code Generator Tools

ETI*EXTRACT(Evolutionary Technologies International) 데이터 이동의 자동화

Page 19: Loading the Data Warehouse (Chapter10) Data Warehousing Lab. Semester 2 HyunSuk Jung

19Data Warehousing

Lab.DW

Oracle Transparent Gateways

OWB 와 함께 사용되는 oracle 제품 오라클이 아닌 데이타베이스를 access