+ All Categories
Home > Documents > Database Design Chapter-2- Database System Concepts and Architecture

Database Design Chapter-2- Database System Concepts and Architecture

Date post: 06-Jan-2018
Category:
Upload: shonda-freeman
View: 244 times
Download: 8 times
Share this document with a friend
Description:
Architecture Evolution DBMS was a tightly integrated system Mainframes replaced by hundreds of distributed computers connected by a network DBMS now is modular in design with client- server architecture
47
1 Database Design Chapter-2- Database System Concepts and Architecture Reference: Prof. Mona Mursi Lecture notes Dr.Lilac Safadi Lecture notes http://www.cse.mrt.ac.lk
Transcript
Page 1: Database Design Chapter-2- Database System Concepts and Architecture

1

Database DesignChapter-2- Database System Concepts and ArchitectureReference: Prof. Mona Mursi Lecture notesDr.Lilac Safadi Lecture noteshttp://www.cse.mrt.ac.lk

Page 2: Database Design Chapter-2- Database System Concepts and Architecture

2

Architecture Evolution

DBMS was a tightly integrated system

DBMS now is modular in designwith client- server architecture

Mainframes replaced by hundredsof distributed computers connected by a network

Page 3: Database Design Chapter-2- Database System Concepts and Architecture

3

Client–Server Architecture

Client 1

Client 2

LAN Server(DBMS) Database

Client Module• Run on user computer• Application programs & user interface that access DB• Handles user interaction and supports GUI

Server Module• Handles data storage.• Access, search .. ect

Page 4: Database Design Chapter-2- Database System Concepts and Architecture

4

Data Model Data Abstraction : hiding details of data storage that

are not needed by most DB users. Data Model: a collection of concepts used to

describe the structure of the DB and a set of operations for specifying retrieval and updates of the DB.

DB Structure : Data types Relationships Constraints

Page 5: Database Design Chapter-2- Database System Concepts and Architecture

5

Categories of Data ModelsHigh Level

(Conceptual Data Model)

Representational (implementation Data Model)

Low Level (Physical Data Model)

Provides concepts close to the wayMany users see data

Provides concepts may be understood by end users but are not far from the way the data is organized.(Entities, Attributes, Relationships)Relational Data Model widely used

Details of how data is stored in the computer. (Computer specialist)(Records format, ordering, access paths : makes the search for a record more efficient)

Page 6: Database Design Chapter-2- Database System Concepts and Architecture

6

Representational (implementation Data Model) Entity: Represent a real-world objects or

concepts. (ex: employee) Attribute: Represent some property of interest

that describes an entity. (ex: salary, name) Relationship: among two or more entities.

(ex: a works-on relationship between an employee and a project)

Page 7: Database Design Chapter-2- Database System Concepts and Architecture

7

Database Schema

Page 8: Database Design Chapter-2- Database System Concepts and Architecture

8

What is DB Schema? A description of the database (meta-data) Covers only some aspects

E.g. name of record type, data items, some constraints

Not changed frequently Specify when a new database defined Meta-data = DBMS Catalog

Schema constructs: Objects in schema Schema diagram : Convention to display the

structure of each record but not the actual instance

Page 9: Database Design Chapter-2- Database System Concepts and Architecture

9

Schema Diagram

STUDENT

COURSE

Name Student_Number Class Major

C_Name C_Number CreditHours Department

Note:Schema diagram displays only some aspects of a schema.Ex: does not show the data types nor the relationship between files.Some conditions can not be represented . EX: student’s majoring in computer science must take CS1310 before the end of their sophomore year.

Schema Construct

Page 10: Database Design Chapter-2- Database System Concepts and Architecture

10

Instances and Schema

Name Account Number Balance

Layla 102 850

Maha 529 1933

Schema

Instances

The data storedIn the database at any given time

The overall designOf the DB

Page 11: Database Design Chapter-2- Database System Concepts and Architecture

Mar 4,2008 11

Example: University DatabaseDB Schema

A DB Instance

Schema Constructs

Page 12: Database Design Chapter-2- Database System Concepts and Architecture

12

Three Levels of Database Abstraction

Physical Level

Conceptual Level

View 1 View 2 View 3 View N……..

Physical Schema

(files of records or structs)ONLY ONE SCHEMA

Conceptual SchemaEx: name, account,

balance

ONLY ONE SCHEMA

Subschema Part of the schema

Controls what info can be seenAS MANY AS NEEDED

Page 13: Database Design Chapter-2- Database System Concepts and Architecture

13

Database State Database state : the data in the database at

particular moment in time. (current set of occurrences or instances).

Every insert, delete, update will change the database state.

Important difference between database state and database schema.

Define a new DB => specify Database schema to the DBMS, At this point the database state is “empty state”. Database is populated or loaded with data => database state changes. At any time there is a current database state.

Page 14: Database Design Chapter-2- Database System Concepts and Architecture

14

Database State Valid state: every state of the database

satisfies the structure and constraints specified in the schema.

The DBMS stores the structure and constraints (meta- data) in the DBMS catalog.

Schema Evolution : adding another data item to the schema. Ex: adding dateofbirth to the student schema.

Page 15: Database Design Chapter-2- Database System Concepts and Architecture

15

Database Instances Data in the database at a particular time

Instance = snapshot = database state ~= current set of occurrences

DB_state(i) insert/delete/update

DB_state(i+1)

Page 16: Database Design Chapter-2- Database System Concepts and Architecture

16

Schema, Instances & DB States Define DB schema DB_state(0) = empty

state DB_state(0) populate initial state DB_state(i) is a valid state for all I

Satisfies the structure and the constraints defined in the schema

DB Schema = intention of the database DB state = extension of the Schema

Page 17: Database Design Chapter-2- Database System Concepts and Architecture

17

Three - Schema Architecture

Page 18: Database Design Chapter-2- Database System Concepts and Architecture

18

DBMS Architecture and Data IndependenceCharacteristics of database approach:1. Insulation of program and data (program-

data and program-operation independence)2. Support of multiple user views3. Use of catalog To achieve the previous characteristics =>

three schema architecture was proposed.The goal was to separate the user applications

and the physical database.

Page 19: Database Design Chapter-2- Database System Concepts and Architecture

19

Visualization of Three-Schema Architecture

USER 1 USER 2

EXTERNAL VIEW 1 EXTERNAL VIEW 2

CONCEPTUAL SCHEMA

INTERNAL SCHEMA

Data DataData

END USER

. . . EXTERNAL LEVEL

CONCEPTUAL LEVEL

INTERNAL LEVEL

Conceptual/internal mapping

External/conceptual mapping

STORED DATABASE

Page 20: Database Design Chapter-2- Database System Concepts and Architecture

20

Three-Schema Architecture

•Internal level: describes how data is stored. The way perceived by the DBMS & OS.

•Conceptual level: describes what data stored in DB, and the relationships among the data. The way perceived by the DBA & programmers.

•External level: describes the part of the DB that user is interested in. The way perceived by the end users.

Page 21: Database Design Chapter-2- Database System Concepts and Architecture

21

Three-Schema Architecture

Emp_No FName LName Dept_No Staff_No LName Salary

View 1 View 2

InternalLevel

ConceptualLevel

EMPLOYEEEmp_No CHAR(6)FName CHAR(15)LName CHAR(15)Dept_No CHAR(3)Salary NUMBER(5)

PREFIX TYPE=BYTE(6),OFFSET=0EMP# TYPE=BYTE(6),OFFSET=6, INDEX=EMPXLNM TYPE=BYTE(15),OFFSET=12FNM TYPE=BYTE(15),OFFSET=27DPT# TYPE=BYTE(4),OFFSET=42PAY TYPE=FULLWORD,OFFSET=46

ExternalLevel

Page 22: Database Design Chapter-2- Database System Concepts and Architecture

22

MappingMapping is the process of transforming requests and results between the Internal, Conceptual & External levels.

Two types of mapping:- External / Conceptual mapping-Conceptual / Internal mapping

Page 23: Database Design Chapter-2- Database System Concepts and Architecture

23

DBMS & Three- Schema Architecture Not all DBMS support three-schema

architecture because: the mapping between the levels require the catalog to be expanded to include information on how to map requests and data among the levels.

=> this requires a software to accomplish the mapping.

=>may cause overhead during compilation or execution of a query or a program & time consuming.

Page 24: Database Design Chapter-2- Database System Concepts and Architecture

24

Data Independence

Page 25: Database Design Chapter-2- Database System Concepts and Architecture

25

Data Independence

Data independence: is the ability to modify a schema definition in one level without affecting a schema definition in the next higher level.

Two levels of data independence:1. Logical data independence2. Physical data independence

Page 26: Database Design Chapter-2- Database System Concepts and Architecture

26

InternalSchema

ConceptualSchema

ExternalSchema

ExternalSchema

ExternalSchema

External/ConceptualMapping

Conceptual/InternalMapping

Logical data Independence

Physical data Independence

Data Independence

Page 27: Database Design Chapter-2- Database System Concepts and Architecture

27

1- Logical data independence The ability to change the conceptual schema

without affecting the external schemas. (application programs)

Ex: adding/ removing a record or a data item The external schema that refer to the

remaining data should not be affected.

Page 28: Database Design Chapter-2- Database System Concepts and Architecture

28

2- Physical data independence

The ability to change the internal schema without affecting the conceptual or external schemas.

This change might be for reorganizing the physical files. EX: creating new access structures to improve the performance of retrieval or update.( i.e. change in the physical files does not affect the queries)

Page 29: Database Design Chapter-2- Database System Concepts and Architecture

29

Database Languages

Page 30: Database Design Chapter-2- Database System Concepts and Architecture

30

Purpose of a Database Language DDL (Data Definition Languages)

Conceptual schema Internal schemas (when schema separation is not clear) External schema (in most DBMSs)

SDL (Store Definition Languages) Internal schema

VDL (View Definition Languages) External view

DML (Data Manipulation Languages) To manipulate the populated data

Modern DB All in one (E.g. SQL) Separate SDL

Page 31: Database Design Chapter-2- Database System Concepts and Architecture

31

Data Definition Language (DDL)

DDL is a descriptive language for defining the database schema

DDL compiler generates meta-data stored in a the data dictionary

Page 32: Database Design Chapter-2- Database System Concepts and Architecture

32

Data Manipulation Language (DML)

DML is a language for retrieving and updating (insert, delete, & modify) the data in the DB

Two classes of languages– Procedural: user specifies what data is required and

how to get those data

– Nonprocedural: user specifies what data is required without specifying how to get those data (e.g. SQL)

Page 33: Database Design Chapter-2- Database System Concepts and Architecture

33

Database LanguagesDBMS have a facility for embedding DDL & DML (sub-languages) in a High-Level Language (COBOL,PASCAL, C), which in this case is considered a host language.

DBMSCall to DB

C,C++,Lisp,..

Local Vars(memory)

ApplicationProgram

Page 34: Database Design Chapter-2- Database System Concepts and Architecture

34

Where the DML is Used? When DML is embedded in program

Programming Language host language DML data sub language

For interactive queries DML query language

General users User friendly interfaces

Page 35: Database Design Chapter-2- Database System Concepts and Architecture

35

DBMS Interfaces Menu- based Form- based Graphic user interface Natural Language interface Interface for parametric users Interfaces for DBA

Page 36: Database Design Chapter-2- Database System Concepts and Architecture

36

Type of interface

What is viewed? Types of users When it’s used?

Menu- based Menus No need to know a query language

Unstructured, exploratory manner

Form- based Forms Naïve users Data entry , retrieve a record

Graphic user interface

Menus & forms , schemas

Manipulated by queries

Natural Language interface

Written language ex: English

Naïve users

Interface for parametric users

People who have to do limited range of operations repeatedly

Limit the number of key strokes (short cuts, hotkeys)

Interfaces for DBA

Privileged commands

DBA Staff Creating accounts, setting the system

Page 37: Database Design Chapter-2- Database System Concepts and Architecture

37

The Database System Environment

Page 38: Database Design Chapter-2- Database System Concepts and Architecture

38

Software Components of a DBMS DBMS Component Modules Database System Utilities Tools Application Environments

Page 39: Database Design Chapter-2- Database System Concepts and Architecture

39

DBMS Component Modules (1/2)

COMPILED (CANNED) TRANSACTIONS

PRIVILEGED COMMANDS

APPLICATION PROGRAMS

INTERACTIVE QUERY

DML STATEMENTS

Application programmers

Casual users

DDL STATEMENTS

DBA Staff

Precompiled

Host Language Compiler

Query Compiler

System Catalog/Data Dictionary

DDL Compiler

DML Compiler

Run-time Database Processor

Stored Data ManagerConcurrency Control/

Backup/Recovery Subsystems

STORED DATABASE

execution execution

Parametric users

execution

Page 40: Database Design Chapter-2- Database System Concepts and Architecture

40

DBMS Component Modules (2/2)

Disk access control OS:DB & catalog are stored on disk .Access to disk is controlled by

OS which schedules disk input/output. Stored Data Manager: controls access to DBMS information stored

in the disk. Compilers

DDL Compiler : process schema definition specified in the DDL, and stores the description of the schema (meta-data) in the DBMS catalog.

Query Compiler: handles high- level queries that are entered interactively.

DML Compiler Precompiler /Host language compiler: extracts DML commands

from an application program written in a host programming language. These commands are sent to the DML complier for compilation into object code for database access.

Handling DB access at runtime Runtime database processor

Page 41: Database Design Chapter-2- Database System Concepts and Architecture

41

Database System Utilities1. Loading: load/transfer existing data files (e.g. text

files or sequential files) into the database.2. Backup: backup copy of the database by dumping

the entire databases onto tape.3. File reorganization: to improve performance4. Performance Monitoring: monitors database usage

and provides statistics to the DBA.

Page 42: Database Design Chapter-2- Database System Concepts and Architecture

42

Tools CASE( Computer Aided Software Engineering

Tools): used in the design phase of database system. Used by DB designers/DBA/users

Examples: Oracle’s Designer/Developer Powersoft’s S- Designer tool. Information Engineering Facility (IEF) to implement the ER.

Data repository systems (Information repository) Used in large organizations, accessed directly by users or DBA Stores :

Catalog information (schema, constraints). Design decisions, Usage standards , application program

descriptions and user information

Page 43: Database Design Chapter-2- Database System Concepts and Architecture

43

Application Development Environments E.g. PowerBuilder/JBuilder Supports

Development of database applications Database design GUI development Querying and updating Application program development

Page 44: Database Design Chapter-2- Database System Concepts and Architecture

44

DBMS Classifications

Page 45: Database Design Chapter-2- Database System Concepts and Architecture

45

DBMS Classification Based on Data Model Relational data model Hierarchical data model Network data model

Example of Example of network data modelnetwork data model

Page 46: Database Design Chapter-2- Database System Concepts and Architecture

46

DBMS Classification Based on Number of Sites (view of control)

Centralized systems Distributed DBMSs (DDBMS)

Homogeneous DDBMS Heterogeneous DBMS (Federated DBMS/multi-

database systems)

Page 47: Database Design Chapter-2- Database System Concepts and Architecture

47

Chapter -2- Summary Data Model Database schema Database state, instances Three Schema Architecture Mapping Data Independence Database Languages & Interfaces The Database System Environment DBMS Classifications


Recommended