1 copyright © 2006, oracle. all rights reserved. introduction to database management

41
1 Copyright © 2006, Oracle. All rights reserved. Introduction to Database Management

Upload: reginald-flowers

Post on 30-Dec-2015

219 views

Category:

Documents


1 download

TRANSCRIPT

1Copyright © 2006, Oracle. All rights reserved.

Introduction to Database Management

1 - 2

Outline

• Architecture ( 架構 ) of Database Applications

• Database Characteristics ( 特性 )

• DBMS Features ( 功能 )

• DBMS Architectures

• People Involved in Database System

1 - 3

資料庫應用系統使用的好處與案例

• 中鋼薪資發放流程的案例 : 工作流程自動化、優化

• 在 7-11或全家便利商店購買東西之後結帳– 店員使用什麼工具結帳?一個資料庫應用系統

— 應用程式— 資料庫— 資料庫管理系統

1.0 Overview

1 - 4

Typical Architecture of Database Application Systems ( 典型的資料庫應用系統架構 )

1.0 Overview

Sales

Database application systems

資料庫管理系統

資料表

( 資料庫 )

application programs

application programs

(應用程式 )

1 - 5

Basic Vocabulary

• Data ( 資料 : 資訊的原料 )– raw facts about things, objects, events, etc.– 陳春賢是一個姓名資訊,陳、春、賢是姓名的原料 ( 中文字 )

( 陳是姓的原料,春與賢名字的原料 )

• Information ( 資訊 )– transformed data that has value for decision making– 「陳春賢」是一個名字 ( 一份簡單的資訊 )– 「資管系」是一個大學系所的名稱 ( 一份簡單的資訊 )– 「長庚大學」是一個大學的名稱 ( 一份簡單的資訊 )– 「陳春賢現在是長庚大學 資管系的老師」是一筆複合的資訊

( 複合資訊 : 可能由人、事、時、地、物等簡單資訊所組成 )

• Database– To store and organize data for retrieval and maintenance

1.0 Overview

1 - 6

資料庫• 資料庫是由

– 一堆邏輯相關的資料和– 資料的描述所組成

• 所謂邏輯相關– 當我們針對一個機構的資訊需要,而建置一個資料庫時,所

儲存的是與機構經營有關的資料, 例如— 某一大學的系所、各系所的學生、課程 、老師 等— 某一公司的產品、 客戶、訂單 、製造、 品管、出貨、庫存等

• 所謂資料的描述– 為了要管理這些邏輯相關的資料,資料庫會儲存為了達到管

理的目的而延伸出來的中介資料 (meta data)。– 稱為「系統目錄」 (system catalog) ,或是「資料字典」

(data dictionary)

1.0 Overview

1 - 7

Database Characteristics ( 資料庫特性 )

• Persistent ( 長存的 )– Data reside on stable storage such as hard disk.

– Different with program variables in memory

• Shared ( 共用的 )– Shared by various users and user groups

• Inter-related ( 互相關聯的 )– Data stored as separate units can be connected

to provide a whole picture (reports or screens).

1.1 Database Characteristics

1 - 8

University Database

Registration(註冊)

Grade Recording(成績登錄)

Faculty Assignment(教師指派)

Course Scheduling(課程表)

Entities: students, faculty, courses, offerings, enrollmentsRelationships: faculty teach offerings, students enroll in offerings, offerings made of courses, ...

Faculty ( 教師 )Courses (科目 )Offerings (開課 )Enrollments ( 選課 )

1.1 Database Characteristics

Database Characteristics • Persistent • Shared• Inter-related

( 上課時間安排 )

Diagram

1 - 9

Database Management System (DBMS, 資料庫管理系統 )

• 介於資料庫應用程式與資料庫 / 檔案系統間的軟體系統,為了方便維護管理資料庫,也為了方便資料庫應用程式的開發和維護。

• A collection of components that support – data acquisition ( 獲取 - 指從外界 ),

– dissemination ( 散播 ),

– storage ( 儲存 ),

– maintenance ( 維護 ),

– retrieval ( 擷取 - 指從資料庫 ), and

– formatting ( 格式化 )

• 這些功能大都透過 DBMS 所提供的資料庫語言來達成,目前最廣泛使用的資料庫語言稱為 SQL (Structured Query Language)

1.2 Features of DBMS

1 - 10

DBMS

• Enterprise DBMSs ( 企業用的 )

• Desktop DBMSs ( 單機型的 – 通常指個人電腦上的 )

• Embedded DBMSs ( 嵌入式的 – 指非個人電腦裝置上的 )

• Major part of information technology infrastructure

1.2 Features of DBMS

1 - 11

DBMS Features ( 功能 )

Feature Description

Database definition

(資料庫定義 )

Language and graphical tools to define entities, relationships, integrity constraints, and authorization rights

Nonprocedural access

(非程序性存取 )

Language and graphical tools to access data without complicated coding

Application development

(應用開發 )

Graphical tools to develop menus, data entry forms, and reports;

data requirements for forms and reports are specified using nonprocedural access

Procedural language interface (程序性語言介面 )

Language that combines nonprocedural access with full capabilities of a programming language

Transaction processing

(交易處理 )

Control mechanisms to prevent interference from

simultaneous users and recover lost data after a failure

Database tuning(資料庫調校 )

Tools to monitor and improve database performance

1.2 Features of DBMS

1 - 12

DBMS Feature 1: Database Definition( 資料庫定義 )

• Define database structure (before using a DB)

• SQL (Structured Query Language) can be used to

define– Table

– Relationships among tables

– Integrity constraints (Rules define allowable data)

– Authorization rights (Rules restrict access to data)

(security constraints)

• Graphical tools

1.2 Features of DBMS

1 - 13

University Database(An Example of Table Definition Tool)

Table definition window in MS Access1.2 Features of DBMS

1 - 14

University Database (An Example of Relationship Definition Tool)

Relationship definition windows in MS Access

1.2 Features of DBMS

1 - 15

DBMS Feature 2: Nonprocedural Access( 非程序性存取 )

• SQL SELECT statement and graphical tools

• QueryA request for data to answer a data-related question

• Indicate what parts of database to retrieve

not the procedural details

(Indicate what to do not how to do)

• Advantage

– Improve productivity ( 生產力 )

99% less code than procedural language program

– Improve data accessibility (資料的可及性 )

1.2 Features of DBMS

1 - 16

Graphical Tool for Nonprocedural Access

Query design windows in MS Access

1.2 Features of DBMS

1 - 17

Graphical Tool for Result of Nonprocedural Access

Result of executing query

1.2 Features of DBMS

1 - 18

DBMS Feature 3: Application Development ( 應用系統開發 )

• 資料庫管理系統除了提供存取資料的功能之外,一般還提供圖形工具(表單和報表)來建立應用系統– Form ( 表單 )

formatted window for data entry, editing and

display

– Report ( 報表 )

formatted document for information display

• Use nonprocedural access to specify data

requirements of forms and reports

1.2 Features of DBMS

1 - 19

Sample Data Entry Form

MS Access form for assigning courses to faculty

1.2 Features of DBMS

1 - 20

Sample Report

MS Access report of faculty workload1.2 Features of DBMS

1 - 21

DBMS Feature 4Procedural Language Interface

( 程序性語言介面 )

• A tool to combine

– a nonprocedural language (such as SQL) with

– a procedural programming language (such as JAVA)

• Why

– Batch processing ( 批次處理 )

– Customization ( 客製化 ) and automation ( 自動化 )

– Granular-level ( 更精細的 ) control of data-processing

logics

1.2 Features of DBMS

1 - 22

DBMS Feature 5: Transaction Processing ( 交易處理 )

• Transaction ( 交易 )

A unit of work that should be reliably processed without

– interference from other users,

– loss of data due to system failures, and

– partial completion

• Control simultaneous users ( 同步使用的使用者們 )

( 例如 : 多人從不同電腦作座位訂位、庫存訂書 )

• Recover from failures

( 例如 : 自一銀行帳戶提款時,錢出來前提款機剛好停機 )

1.2 Features of DBMS

1 - 23

DBMS Feature 6: Database Tuning ( 資料庫調校 )

• Include a number of monitors and utility programs to improve database performance

• Monitor ( 監控程式 )– How a database is used– Usage distribution of various parts of a database– Growth of the database

• Utility programs ( 支援程式 )– Reorganize a database– Select physical structures for better performance– Repair damaged parts of a database

1.2 Features of DBMS

1 - 24

Database Technology Evolution

Era Generation Orientation Major Features

1960s 1st Generation File File Structure and Proprietary program interfaces

1970s 2nd Generation Network

Navigation

Networks and hierarchies of related records, standard program interfaces

1980s 3rd Generation Relational Non-procedural languages, performance optimization, transaction processing

1990s 4th Generation Object Multi-media, active, distributed processing, XML enabled

1.3 Development of Database Technology and Market Structure

1 - 25

DBMS Marketplace

Enterprise DBMS ( 企業型 DBMS)

• Oracle: dominates in Unix; strong in Windows

• SQL Server: strong in Windows

• DB2: strong in mainframe environment

• Significant open source DBMSs: MySQL, Firebird,

PostgreSQL

Desktop DBMS ( 單機型 DBMS)

• Access: dominates

• FoxPro, Paradox, FileMaker Pro

1.3 Development of Database Technology and Market Structure

1 - 26

Data Independence ( 資料獨立性 )

• The cost of database changes is a large part (~50%) of software maintenance resources.

• Reduce the impact of database changes by separating database definition from applications– In early DBMSs, most changes to database definition

caused changes to computer programs.

• Data Independence– A database should have an identity separate from the

applications that use it.

– The separate identity allows the database definition to be changed without affecting related applications.

1.4 Architecture of DBMS

1 - 27

Three Schema Architecture ( 三層綱要架構 )

• In mid-1970s, the concept of data independence led

to the proposal of the Three Schema Architecture.

• Schema: Database Description

• Three Schema Architecture includes three levels of

database description

1.4 Architecture of DBMS

1 - 28

Three Schema Architecture

Database can be viewed at three levels of abstraction• External Level (external schema)

– The way users perceive the data in a database– Each group of users can have a separate external view of a

database tailored to the group’s specific needs.

• Conceptual Level (conceptual schema)– The whole picture perceived by all users– Integrates external schemas

• Internal Level (internal schema)– The way DBMS and OS perceive the data in a database– Defines physical storage structures – Define files (collections of data) on storage devices (such as hard

disks).

1.4 Architecture of DBMS

1 - 29

Three Schema Architecture

View 1 View 2 View n

Conceptual Schema

Internal Schema

External Level

Conceptual Level

Internal Level

External to Conceptual Mappings

Conceptual to Internal Mappings

1.4 Architecture of DBMS

1 - 30

Three Schema Architecture

1.4 Architecture of DBMS

1 - 31

Differences BetweenThree Schema Architecture

1.4 Architecture of DBMS

( 生日 )

( 外觀 1)

( 外觀 2)

1 - 32

Differences Among Levels: Example

External• Faculty Course Assignment Form View:

– data required for the form in Figure 1.9 of textbook

• Faculty Work Load Report View: – data required for the report in Figure 1.10 of textbook

Conceptual• Tables and Relationships in Figure 1.6 of textbook

Internal• Files needed to store the tables

• Extra files to improve performance

1.4 Architecture of DBMS

1 - 33

Schema Mappings( 綱要對應 )

• Describe how a schema at a higher level is derived

from a schema at a lower level.

– For example, the external views in slide 31 are derived

from the table in the conceptual schema.

• The mapping provides the knowledge to convert

– a data request using an external view into

– a data request using the tables in conceptual schema

• The mapping between conceptual and internal levels

shows how data entities are stored in files.

1.4 Architecture of DBMS

1 - 34

Schema and Mappings

DBMSs, using schemas and mappings, ensure data independence.

1. Typically, an application accesses a database using a view.

2. The DBMS converts a data request from an application into a

data request using the conceptual schema rather than the view.

3. The DBMS then transforms a data request using the

conceptual schema into a data request using the internal

schema.

4. Most changes to the conceptual or internal schema do NOT

affect applications because applications do not directly use the

lower schema levels.

5. The DBMS, not the user, is responsible for using the mappings

to make the transformations.

1.4 Architecture of DBMS

1 - 35

Data Independence and Three Schema Architecture

1.4 Architecture of DBMS

1 - 36

Client-Server Architecture

1.4 Architecture of DBMS

Database

Database

a) Client, server, and database on the same computer

b) Mulitple clients and 1 server on different computers

c) Multiple servers and databases on different computers

Client

Server

Client Server

Client Server Server

DatabaseDatabase

Client

Client

Client

Client

Client

1 - 37

People Involved in Database System

• Data Administrators ( 資料管理師 )

• Database Administrators (資料庫管理師 )

– 簡稱 DBA

• Database Designers (資料庫設計師 )

• Application Developers

– System Analyst ( 系統分析師 )

– Programmer ( 程式設計師 )

• End Users ( 終端使用者 )

1.5 Organizational Impacts of Database Technology

1 - 38

Classification & Responsibilities of DBAs

Technical DBA• Designing conceptual schemas• Designing internal schemas• Monitoring database performance• Selecting and evaluating database software• Designing client-server database• Troubleshooting database problems ( 資料庫問題處

理 )

Nontechnical DBA• Setting database standards, e.g., coding stangards• Devising training materials• Promoting benefits of databases• Consulting with users ( 使用者諮詢 )

1.5 Organizational Impacts of Database Technology

1 - 39

Database Specialists ( 專業人員 )

Database Administrator (DBA ,資料庫管理師 ) • A technical support position that specializes in managing

databases and DBMSs.

• More technical

• Having DBMS related skills

Data Administrator (DA, 資料管理師 )• A management position that performs planning and policy

setting for the information resources of an entire organization.

• Less technical

• Planning role

1.5 Organizational Impacts of Database Technology

1 - 40

Various Organizational Placement of DA and DBA

1.5 Organizational Impacts of Database Technology

1 - 41

Summary

• Databases and database technology is vital ( 至關重要 ) to modern organizations

• Database technology supports daily operations and

decision making in modern organizations

• Nonprocedural access is a crucial feature ( 重要功能 )

自我練習 第一章 21頁 Questions : 4, 5, 6, 14, 15, 25, 26