Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized...

30
Database Environment Chapter 2

Transcript of Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized...

Page 1: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Database Environment

Chapter 2

Page 2: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:
Page 3: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Data Independence

Sometimes the way data are physically organized depends on the requirements of the application .

Result: it is impossible to change the storage structure without

affecting the application this is typically a problem introduced by the file handling

software , and not by the problem to solve

Data independence is needed because :different applications need different views on the same data the database administrator must have the freedom to change

the storage structure, file organization and access strategy

Page 4: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Definition of Data Independence

Data independence is the independence of data and applications.

data structures can be modified without affecting applications

applications can be modified without affecting other applications

A possibility to achieve this:Three level database architecture

Page 5: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Three level database architecture

Conceptual level: Reflects the community user view

External level: Reflects the user view

Internal level: Close to the physical storage

It is a framework describing general concepts

not all database systems follow this architecture

Page 6: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

ANSI-SPARC and CODASYLThree-level Architecture

Page 7: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

ANSI-SPARC three-level Architecture

Reasons for this architecture

user should have access to the same data , but have a customized view of the data

users should not have to deal directly with physical database storage details

the DBA should be able to change the database storage structure without affecting the users’ view

DBA should be able to change the conceptual or global structure of the database without affecting all users

Page 8: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

External Level

The user’s view of the database.

This level describes that part of the database that is relevant to a particular user or group of users

number of different external views familiar to or efficient for the user part of the database can be hidden for certain users different presentations of the same data (e.g. dates) can include derived or calculated data, not stored

in the database

Page 9: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Conceptual Level

The community view of the database.

This level describes what data is stored in the database and the relationships among the data.

Logical structure of the entire database as seen by the DBA, independent of any storage considerationsall entities, attributes and relationshipsconstraints on the datasemantic information about the datasecurity and integrity information

Supports all external views

Page 10: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Internal LevelThe physical representation of the database on the computer. This level describes how the data is stored in the database.

to achieve optimal run-time performance and storage space utilization

data structures and storage devices file organization, indexes, … general aspects

storage space allocation for data and indexes record description for storage record placementdata compression and data encryption techniques

Page 11: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Differences between Three Levels of ANSI-SPARC Architecture

Page 12: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Data Independence

Logical Data Independence.

Refers to immunity of external schemas to changes in conceptual schema.

Conceptual schema changes e.g. addition/removal of entities.

Should not require changes to external schema or rewrites of application programs.

Page 13: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Data Independence

Physical Data Independence

Refers to immunity of conceptual schema to changes in the internal schema.

Internal schema changes e.g. using different file organizations, storage structures/devices.

Should not require change to conceptual or external schemas.

Page 14: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Data Independence and the ANSI-SPARC Three-level Architecture

Page 15: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Database Languages

Data Definition Language (DDL)

Allows DBA or user to describe and name entitles, attributes and relationships required for the application.

Page 16: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Database Languages

Data Manipulation Language (DML)

Provides basic data manipulation operations on data held in the database.

Procedural DML - allows user to tell system exactly how to manipulate data.

Non-Procedural DML - allows user to state what data is needed rather than how it is to be retrieved.

Page 17: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Database Languages

Fourth Generation Language (4GL)

Query Languages

Forms Generators

Report Generators

Graphics Generators

Application Generators

Page 18: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Host Language

Program

DML-statements

ProceduralLanguagee.g. Pascalincluding DML-statements

Pre-compiler

CompiledDML

module

Program

Call-statements

3GLCompiler

Object-code

Call

Page 19: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Data Model

Collection of concepts for describing data, relationships between data and constraints on the data in an organization.

Data Model comprises:A structural part.A manipulative part.Possibly a set of integrity rules.

Page 20: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Conceptual modeling

The process of developing a conceptual data model that is

a complete and accurate representation of an organization's data requirements.

independent of implementation details.

Page 21: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Functions of a DBMS

Data Storage, Retrieval and Update.

Must furnish users with the ability to store, retrieve, and update data in the database.

A User-Accessible Catalog.

Must furnish a catalog in which descriptions of data items are stored and which is accessible to users.

Page 22: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Functions of a DBMS

Transaction SupportMust furnish a mechanism to ensure that either all

the updates corresponding to a given transaction are made or that none of them are made.

Concurrency Control ServicesMust furnish a mechanism to ensure that database

is updated correctly when multiple users are updating the database concurrently.

Page 23: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Functions of a DBMS

Recovery ServicesMust furnish a mechanism for recovering the

database in the event that the database is damaged in any way.

Authorization ServicesMust furnish a mechanism to ensure that only

authorized users can access the database.

Page 24: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Functions of a DBMS

Support for Data CommunicationMust be capable of integrating with communication

software.

Integrity ServicesMust furnish a means to ensure that both the data in

the database and changes to the data follow certain rules.

Page 25: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Functions of a DBMS

Services to Promote Data IndependenceMust include facilities to support the independence

of programs from the actual structure of the database.

Utility ServicesShould provide a set of utility services.

Page 26: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Components of a DBMS

Page 27: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Components of a DBMS

Query processor

Database manager (DM)

File manager

DML preprocessor

DDL compiler

Catalog manager

Page 28: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Components of Database Manager (DM)

Page 29: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

Components of Database Manager (DM) Authorization control

Command processor

Integrity checker

Query optimizer

Transaction manager

Scheduler

Recovery manager

Buffer manager

Page 30: Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:

The Catalog Catalog, meta-data, data dictionary, repository

names, types and sizes of data itemsnames of relationships integrity constraints on the dataauthorizationsusage statisticsschema mappings

Benefitscentrally stored meta-datasimpler communication identification of redundancy and inconsistencychanges to the database can be recorded and followed-up security can be enforced integrity can be ensuredaudit information can be provided