0% found this document useful (0 votes)
22 views

ch02 - Database Environment

Database

Uploaded by

Julian Lao
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

ch02 - Database Environment

Database

Uploaded by

Julian Lao
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 76

Chapter 2

Database Environment
Transparencies

© Pearson Education Limited 1995, 2005 1


Chapter 2 - Objectives

 Purpose of three-level database architecture.


 Contents of external, conceptual, and internal levels.
 Purpose of external/conceptual and
conceptual/internal mappings.
 Meaning of logical and physical data independence.
 Distinction between DDL and DML.
 A classification of data models.

2
© Pearson Education Limited 1995, 2005
Chapter 2 - Objectives
 Purpose/importance of conceptual modeling.
 Typical functions and services a DBMS should
provide.
 Function and importance of system catalog.
 Software components of a DBMS.
 Meaning of client–server architecture and
advantages of this type of architecture for a
DBMS.
 Function and uses of Transaction Processing
Monitors.
3
© Pearson Education Limited 1995, 2005
 The major aim of a database system is to provide users
with an abstract (mental) view of data, hiding certain
detail of how data is stored and manipulated.
 Since database is a shared resource, each user may
require a different view of the data held in the database.
To satisfy these needs, the architecture of most
commercial DBMS available today is based to some
extent on the so-called American National Standard
Institute- Standard Planning and Requirements
Committee (ANSI-SPARC) architecture.
4
 An early proposal for standard terminology and
general architecture for database system was produced
in 1971 by Database Task Group (DBTG) appointed
by CODASYL.
 Recognized the need for two-level approach (schema
and sub schemas)
 ANSI-SPARC in 1975 produce similar terminology
and architecture- recognize the need of three-level
approach with a system catalog.
 The three level architecture- external, conceptual and
internal level. (discuss later..) 5
Objectives of Three-Level Architecture
 All users should be able to access same data
but have a different customized view the data.
(user can change the way he/she view but not affect
other users)
 A user’s view is immune (safe) to changes made
in other views.
 Users should not need to know physical
database storage details.

6
© Pearson Education Limited 1995, 2005
Objectives of Three-Level Architecture
 DBA should be able to change database storage
structures without affecting the users’ views.

 Internal structure of database should be


unaffected by changes to physical aspects of
storage.

 DBA should be able to change conceptual


structure of database without affecting all users.

7
© Pearson Education Limited 1995, 2005
ANSI-SPARC Three-Level Architecture

8
© Pearson Education Limited 1995, 2005
ANSI-SPARC Three-Level Architecture
 External Level
– Users’ view of the database.
– Describes that part of database that is
relevant to a particular user.
– Includes only those entities, attributes and
relationships in the “real world” that the
user is interested in- those are not may be
represented in the database but the user will
be unaware of them.

9
© Pearson Education Limited 1995, 2005
ANSI-SPARC Three-Level Architecture
 External Level
– Different view may have different representation
of the same data. Example, one user view dates
in the form (day, month, year) while other may
view (year, month, day). Some views might
include derived or calculated data: created when
needed. Example, age of the member of staff; the
date of birth would be stored and age would be
calculated by DBMS when it is referenced.
– Views may even include data combine or derived
from several entities.
10
© Pearson Education Limited 1995, 2005
ANSI-SPARC Three-Level Architecture
 Conceptual Level
– Community view of the database.
– Describes what data is stored in database and
relationships among the data.
– It contains the logical structure of the database
as seen by the DBA.
– Represents: all entities, their attributes and their
relationships; the constraints on the data;
semantic information about the data; security
and integrity information.
11
© Pearson Education Limited 1995, 2005
ANSI-SPARC Three-Level Architecture
 Conceptual Level
– Supports each external views; must not contain
any storage-dependent details. For instance, the
description of an entity should contain only data
types(integer, real, character) and length
(maximum number of digits or character) but
not any storage considerations such as number
of bytes occupied.

12
© Pearson Education Limited 1995, 2005
ANSI-SPARC Three-Level Architecture

 Internal Level
– Physical representation of the database on the
computer for optimal runtime performance and
storage space utilization.
– Describes how the data is stored in the
database.

13
© Pearson Education Limited 1995, 2005
Schema, Mappings and Instances
 The over all description of the database is called
schema. There are three different types of schema in
the database define according to the levels of
abstraction (idea) of the three-level architecture.
 Multiple external schema (subschemas) corresponds to
the different views of the data.
 Conceptual schema describes all entities, attributes and
relationships together with integrity constraints.

14
Schema, Mappings and Instances
 Internal schema which is the complete description of the
internal model, containing the definitions of stored
records, the method of representation, the data fields and
the indexes and storage structures used.
 There is only one conceptual schema and one internal
schema per database.
 DBMS is responsible in mapping between these three
types of schema. DBMS must confirm that each external
schema is derivable from the conceptual schema, and it
must use the information in the conceptual schema to map
between each external schema and the internal schema. 15
Schema, Mappings and Instances
 The conceptual schema is related to internal schema
through conceptual/internal mapping. This mapping
enable the DBMS to find the actual record or combination
of records in physical storage that constitute (found) a
logical record in the conceptual schema, together with any
constraints (limitations) to be enforced (required) in the
operations for that logical record.
 Each external schema is related to conceptual schema by
the external/conceptual mapping. This mapping enables
the DBMS to map names in the user’s view to the relevant
part of the conceptual schema.
16
Differences between Three Levels of ANSI-
SPARC Architecture

17
© Pearson Education Limited 1995, 2005
 The two external views are merge into one conceptual view. In
this merge process, the major difference is that the age field has
been changed into date-of-birth (DOB). The database maintains
the external/conceptual mapping; for example, it maps the sNo
field of the first external view to the StaffNo field of the
conceptual record. The conceptual level is then mapped to the
internal level, which contains a physical description of the
structure for the conceptual record. At this level, we see a
definition of the structure in high-level language. The structure
contains the pointer, next, which allows the list of staff records to
be physically linked together to form a chain. Note that the order
of fields at the internal level is different that at the conceptual
level. Again, the DBMS maintains the conceptual/ internal
mapping. 18
 It is important distinguish between the description of the
database and the database itself. The description of the
database is the database schema. The schema is specified
during the database design process and is not expected to
change frequently.
 However, the actual data in the database change frequently;
for example it change every time we insert new member of
staff.
 The data in the database is called database instance.
Therefore, many database instances can correspond to the
same database schema. The schema is sometimes called the
intension of the database; an instance is called extension(or
19
state) of the database.
Data Independence
 The major objective for the three-level
architecture is to provide Data Independence,
which means that upper level are unaffected by
changes to lower levels.
 There are two kinds of data independence
– Logical Independence
– Physical Independence

20
© Pearson Education Limited 1995, 2005
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, attributes or
relationship) should not require changes to
external schema or rewrites of application
programs.
– The user whom the changes have been made
need to be aware of them- other should not.
21
© Pearson Education Limited 1995, 2005
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.
– From the user’s point of you, the only effect
that may be noticed is the change in
performance.
22
© Pearson Education Limited 1995, 2005
Data Independence
 Physical Data Independence
– The deterioration in the performance is the
most common reason for internal schema
changes.

23
© Pearson Education Limited 1995, 2005
Data Independence and the ANSI-SPARC
Three-Level Architecture

24
© Pearson Education Limited 1995, 2005
 The figure illustrate where each type of data
independence occurs in relation to the three-level
architecture.
 The two-stage mapping in the ANSI-SPARC
architecture may be inefficient, but it also provides
grater data independence. However, for more efficient
mapping, the ANSI-SPARC model shows the direct
mapping of external schemas onto the internal schema,
by-passing the conceptual schema. This mapping of
course reduces data independence, so that every time the
internal schema changes, the external schema and any
dependent application programs may also have to 25
Database Languages
 The database sublanguage consist of two parts:
– Data Definition Language (DDL)
– Data Manipulation Language (DML)
 Data Definition Language (DDL)
– Allows the DBA or user to describe and
name entities, attributes, and relationships
required for the application
– plus any associated integrity and security
constraints.

26
© Pearson Education Limited 1995, 2005
Database Languages
 Data Definition Language (DDL)
 It cannot be used to manipulate data.
 The result of the compilation of the DDL
statements is a set of tables stored in special file
called system catalog.
 System Catalog integrates the metadata- data
that describes the objects in the database and
makes it easier for those objects to be accessed
or manipulated.

27
© Pearson Education Limited 1995, 2005
Database Languages
 Data Definition Language (DDL)
 Metadata contains definitions of records, data
items and other objects that are interest to user
or are required by the DBMS.

28
© Pearson Education Limited 1995, 2005
Database Languages
 Data Manipulation Language (DML)
– Provides basic data manipulation operations
on data held in the database.
– The operation usually includes:
» Insertion of new data into the database
» Modification of data stored in the database
» Retrieval of data contained in the database
» Deletion of data from the database.
 One of the function of database is to support a
Data Manipulation Language in which the user
can construct statements that will cause such
data manipulation to occur.
29
© Pearson Education Limited 1995, 2005
Database Languages
 Data Manipulation applies to three levels.
However, at the internal level we must define
rather than complex low-level procedures that
allow efficient data access. In higher level,
emphasis is placed on ease of use and effort is
directed at providing efficient user interaction
with the system.
 Part of a DML that involves data retrieval is
called Query Language. It can be defined as
high-level special-purpose language used to
satisfy diverse request for the retrieval of data
held in the database.
30
© Pearson Education Limited 1995, 2005
Database Languages
 Data Manipulation Language (DML) can be
distinguish between Procedural and Non-
Procedural.
 Procedural DML
– allows user to tell system what data is
needed and exactly how to retrieve/
manipulate data.
– The user must express all the data access
operations that are to be used by calling
appropriate procedures to obtain the
information required.
31
© Pearson Education Limited 1995, 2005
Database Languages
 Procedural DML
– Are embedded in a high-level programming
language that contains construct to facilitate
iteration and handle navigational logic.
– Network and Hierarchical DML are
normally procedural.

32
© Pearson Education Limited 1995, 2005
Database Languages
 Non-Procedural DML
– allows user to state what data is needed
rather than how it is to be retrieved.
– Allows the required data to be specified in a
single retrieval or update statement.
– The DBMS translate the DML statement
into one or more procedure that manipulate
the required sets of records, which frees the
user from having to know the how data
structures are internally implemented and
what algorithm are required to retrieve and
passively transform data.
33
© Pearson Education Limited 1995, 2005
Database Languages
 Non-Procedural DML
– Non-Procedural Languages are also called
declarative language.
– Relational DBMSs usually include some
form of nonprocedural language for data
manipulation, usually SQL or SQB(Query-
By-Example)
– Easier than procedural DML, as less work is
done by the user and more by the DBMS.

34
© Pearson Education Limited 1995, 2005
Database Languages
 Fourth Generation Languages (4GLs)
– It is a shorthand programming language.
Requires fewer lines.
– User define what is to be done, not how.
– Rely largely on much higher-level components
known as forth-generation tools.
– The user does not define the steps that the
program needs to perform the task, but instead
define the parameters (bounds) for the tools
that use them to generate an application
program.
35
© Pearson Education Limited 1995, 2005
Database Languages
 Fourth Generation Languages (4GLs) Types
– Form generator is a interactive facility for
rapidly creating data input and display layout
for screen forms.
– Allows the user to define what the screen is to
be look like, what information to be displayed,
and where on the screen it is to be displayed.
– Allow the definition of color of screen elements
and other characteristics such as bold,
underline, blinking, and alike

36
© Pearson Education Limited 1995, 2005
Database Languages
 Fourth Generation Languages (4GLs) Types
– Report generator is a facility for creating
reports from data stored in the database. It is
similar to a query language, it allows the user to
as questions of the database and retrieve
information from it for the report.
– We have much greater control over what the
output looks like. It may automatically
determine how the output should look or can
create our own customized output report using
special-report generator command instruction.
37
© Pearson Education Limited 1995, 2005
Database Languages
 Fourth Generation Languages (4GLs) Types
– Graphic generator is a facility to retrieve data
from the database and display the data as a
graph showing trends and relationships in the
data.
– Allows the user to create the chart.

38
© Pearson Education Limited 1995, 2005
Database Languages
 Fourth Generation Languages (4GLs) Types
– Application generator is a facility for producing a
program that interfaces with the database.
– Reduce the time it take to design and entire software
application.
– Consist of prewritten modules, that comprise
(include) fundamental functions that most program
used.
– Usually written in high-level language, constitute
library of function to choose from.
– The user specifies what the program is supposed to
do; the application generator determine how to
perform the task. 39
© Pearson Education Limited 1995, 2005
Data Model
 Data Model is a higher level description of
schema . It is a representation of a real-world
objects and events, and their associations
(relation/links)
 It is an integrated collection of concepts for
describing and manipulating data,
relationships between data, and constraints on
the data in an organization.

40
© Pearson Education Limited 1995, 2005
Data Model
 Data Model comprises:
– a structural part- consisting of a set of rules
according to which database can be constructed.
– a manipulative part-defining the types of
operation that are allowed on the data (this
includes the operations that are used for
updating and retrieving data from the database
and for changing the structure of the database).

41
© Pearson Education Limited 1995, 2005
Data Model
 Data Model comprises:
– a set of integrity constraints, which ensure the
data is accurate.
 Purpose
– To represent data in an understandable way.
 Categories of data models include:
– Object-based
– Record-based
– Physical
42
© Pearson Education Limited 1995, 2005
Data Models
 Object-Based Data Models
– Use concepts such as entities, attributes and
relationships.
– An entity is a distinct object (person, place,
thing, concept, event) in the organization
that is to be represented in the database.
– An attribute is a property that describes
some aspect of the object that we wish to
record (name, address, course)
– A relationship is the association (link)
between entities.
43
© Pearson Education Limited 1995, 2005
Data Models
 Object-Based Data Models Types
– Entity-Relationship
– Semantic
– Functional
– Object-Oriented

44
© Pearson Education Limited 1995, 2005
Data Models
 Record-Based Data Models
– The database consist of a number of fixed-
format records, possibly of different types.
– Each record type defines a fixed number of
fields, typically of a fixed length.
 Record-Based Data Models Types
– Relational Data Model
– Network Data Model
– Hierarchical Data Model

45
© Pearson Education Limited 1995, 2005
Relational Data Model

46
© Pearson Education Limited 1995, 2005
Network Data Model

47
© Pearson Education Limited 1995, 2005
Hierarchical Data Model

48
© Pearson Education Limited 1995, 2005
Conceptual Modeling
 Conceptual schema is the core of a system
supporting all user views.
 Should be complete and accurate representation
of an organization’s data requirements.
 Conceptual modeling is a process of developing
a model of information that is independent of
implementation details.
 Result is a conceptual data model.

49
© Pearson Education Limited 1995, 2005
Functions of a DBMS
 Data Storage, Retrieval, and Update
– The DBMS must furnish user with the
ability to store, retrieve and update data in
the database’
 A User-Accessible Catalog
– The DBMS must furnish a catalog in which
descriptions of data items are stored and
which is accessible to user.

50
© Pearson Education Limited 1995, 2005
Functions of a DBMS
 Transaction Support
– The DBMS must furnish a mechanism that
will ensure either that all the updates
corresponding to a given transaction are
made or that none of them is made.
 Concurrency Control Services
– The DBMS must furnish a mechanism to
ensure that the database is updated
correctly when multiple users are updating
the database concurrently (simultaneously).

51
© Pearson Education Limited 1995, 2005
Functions of a DBMS
 Recovery Services
– The DBMS must furnish a mechanism for
recovering the database in the event that the
database is damage in any way.
 Authorization Services
– The DBMS must furnish a mechanism to
ensure that only authorized users can access
the database.

52
© Pearson Education Limited 1995, 2005
Functions of a DBMS
 Support for Data Communication
– The DBMS must be capable of integrating
with communication software.
 Integrity Services
– The DBMS must furnish a means to ensure
that both the data in the database and
changes to the data follow certain rules.

53
© Pearson Education Limited 1995, 2005
Functions of a DBMS
 Services to Promote Data Independence
– The DBMS must include facilities to support
the independence of programs from the
actual structure of the database.
 Utility Services
– The DBMS provide a set of utility services.

54
© Pearson Education Limited 1995, 2005
System Catalog
 Repository of information (metadata)
describing the data in the database.
 One of the fundamental components of DBMS.
 Typically stores:
– names, types, and sizes of data items;
– constraints on the data;
– names of authorized users;
– data items accessible by a user and the type of
access;
– usage statistics.
55
© Pearson Education Limited 1995, 2005
Components of a DBMS

56
© Pearson Education Limited 1995, 2005
Components of DBMS
 Query Processor- transforms queries into series of
low-level instructions directed to the database
manager
 Database Manager- interfaces with user-submitted
application programs and queries. DM accept
queries and examine the external and conceptual
schemas to determine what conceptual records are
required to satisfy the request. The DM then place a
call to the File manager to perform the request.

57
© Pearson Education Limited 1995, 2005
Components of DBMS
 File Manager- manipulates the underlying storage
files and manages the allocation of storage space on
disk. It establishes and maintain the list of
structures and indexes defined in the internal
schema. If hashed files are used, it calls on the
hashing function to generate record address.
However, the file manager does not directly manage
the physical input and output data. Rather, it passes
the request on to the appropriate access methods,
which either read data from or write data into the
system buffer. 58
© Pearson Education Limited 1995, 2005
Components of DBMS
 DML Preprocessor- this module converts DML
statements embedded in an application program
into standard function calls in the host language.
Must interact with the query processor to generate
the appropriate code.
 DDL Compiler- converts the DDL statement into a
set of tables containing metadata. These table are
then stored in the system catalog while control
information is stored in the data file headers.

59
© Pearson Education Limited 1995, 2005
Components of DBMS
 Catalog Manager- manages access to and maintain
the system catalog. The system catalog is accessed by
most DBMS components.

60
© Pearson Education Limited 1995, 2005
Components of Database Manager (DM)

61
© Pearson Education Limited 1995, 2005
Major Software Components for DM
 Authorization Control- this module confirms
whether the user has the necessary authorization to
carry out the required operation.
 Command Processor- once the system has confirm
that the user has authority to carry out the
operation, control is passed to the command
processor.
 Integrity Checker- for an operation that changes the
database, the integrity checker checks whether the
requested operation satisfies all necessary integrity
constraints.
62
© Pearson Education Limited 1995, 2005
Components of DM
 Query Optimizer- this module determines an
optional strategy for the query execution.
 Transaction Manager- this module performs the
required processing of operations that receives form
transactions.
 Scheduler- this module is responsible for ensuring
that concurrent operations on database proceed
without conflicting with one another. It controls the
relative order in which transactions are executed.

63
© Pearson Education Limited 1995, 2005
Components of DM
 Recovery Manager- this module ensures that the
database remains in a consistent state in the
presence of failure. It is responsible for transaction
commit and abort.
 Buffer Manager- this module is responsible for the
transfer of data between main memory and
secondary storage, like disk. The recovery manager
and buffer manager are sometimes referred to
collectively as data manager. The buffer manager is
sometimes known as the cache manager.
64
© Pearson Education Limited 1995, 2005
Multi-User DBMS Architectures
 Teleprocessing

 File-server

 Client-server

65
© Pearson Education Limited 1995, 2005
Teleprocessing
 Traditional architecture.
 Single mainframe with a number of
terminals attached.
 Trend is now towards downsizing.

66
© Pearson Education Limited 1995, 2005
File-Server
 File-server is connected to several workstations
across a network.

 Database resides on file-server.

 DBMS and applications run on each


workstation.

 Disadvantages include:
– Significant network traffic.
– Copy of DBMS on each workstation. 67
© Pearson Education Limited 1995, 2005

File-Server Architecture

68
© Pearson Education Limited 1995, 2005
Traditional Two-Tier Client-Server
 Client (tier 1) manages user interface and runs
applications.
 Server (tier 2) holds database and DBMS.

 Advantages include:
– wider access to existing databases;
– increased performance;
– possible reduction in hardware costs;
– reduction in communication costs;
– increased consistency.

69
© Pearson Education Limited 1995, 2005
Traditional Two-Tier Client-Server

70
© Pearson Education Limited 1995, 2005
Traditional Two-Tier Client-Server

71
© Pearson Education Limited 1995, 2005
Three-Tier Client-Server
 Client side presented two problems preventing
true scalability:
– ‘Fat’ client, requiring considerable resources on
client’s computer to run effectively. A fat client
(sometimes called a thick client) is a networked
computer with most resources installed locally, rather
than distributed over a network as is the case with a
thin client.
– Significant client side administration overhead.
 By 1995, three layers proposed, each
potentially running on a different platform.
72
© Pearson Education Limited 1995, 2005
Three-Tier Client-Server
 Advantages:
– ‘Thin’ client, requiring less expensive hardware.
– Application maintenance centralized.
– Easier to modify or replace one tier without
affecting others.
– Separating business logic from database functions
makes it easier to implement load balancing.
– Maps quite naturally to Web environment.

73
© Pearson Education Limited 1995, 2005
Three-Tier Client-Server

74
© Pearson Education Limited 1995, 2005
Transaction Processing Monitors
 Program that controls data transfer between
clients and servers in order to provide a
consistent environment, particularly for Online
Transaction Processing (OLTP).

75
© Pearson Education Limited 1995, 2005
TPM as middle tier of 3-tier client-server

76
© Pearson Education Limited 1995, 2005

You might also like