Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

FUNCTION OF DBMS

(1)Data storage,retrival and update


to store, retricvc and update data in the datahas
a DBMS must furnish users with the ability the DEMS shrnuld
functionally
This is the fundamental function of a DBMS. In providing this
details from the user.
hide the internal physical implementation

(2) A user-accessiblecatalog
stored and which is
in which description of data items
are
A DBMS must furnish catalog
a
of an
feature of the ANSI SPARK architecture is the recognition
accessible by users. A key and s on. The
to hold data about the schemas, users, application
integrated system catalog
accessible to users as well as the DBMS.
A systcm catalog or data
catalog is expected to be
data abrut
of information describing the data in the datahase. It is the
dictionary is a repository with the
information is ued vary
data or meta data. The amount of information and the way the
DBMS.Typically the system catalog stores:
Names, types and sizes of data items.
Names of relationship.
Integrity constraints on the data
who have access to the data
Names of authorized users

and the mapping between the schemas.


External, conceptual and internal schemas
transaction and counts on the number of
Usage statistics such as the frequency of
accesses made to objects in the
database

Some benefits of a system catalog are:


to maintain
Information about data can be collected and stored centrally. This helps
control over the data as resource.
which will help other users understand the purpose
The meaning of data can be defined,
of the data.
The system catalog also
Communication is simplified, since exact meaning is stored.
identifies the user or users who own or access the data.
easily since the data is
Redundancy and inconsistencies can be identified more

centralized

Changes to the database can be recorded.


The impact of a change can be determined it is implementation since the system catalog
records each data item, all its relationship and all its users.

Security can be enforced.


Integrity can be ensured.
Audit information can be provided.

Notes Prepared by Ms. Peninah J. Limo Page 1


3. Transaction support
A DBMS must furnish a mechanism which will ensure either that all the updates coresponding
to a given transaction are made or that none of them is made.

A transaction is a sehes of actions carried out by a single user or application program. which
accesses or changes the contents of the database.

4.Concurrency control services


A DBMS must furnish a mechanism to ensure that the database is updated correctly when
multiple users are updating the database concurrently.
One major objective of using a DBMs is to enable many users to access shared data
concurrently. Concurrent access is relatively casy if all users are only reading data as there is no
way that they can interfere with one another. However, when two or more users are
database
accessing the
simultaneously and at least one of them is updating data, there may be interference thar
can result in inconsistencies.

5. Recovery services

A DBMs must furnish mechanism for


a
recovering the database in the event that the database is
damaged in any way.
This may be a result of a system arrest media
failure, a hardware or software error causing the
DBMS to stop, or it may be result of the user's
detecting an error during the transaction and
aborting the transaction before it completes. In all these cases, the DBMs must
mechanism recover the database to a consistent state.
to
provide a

6. Authorization services

A DBMs must furnish mechanism to ensure that only authorized users can access
a
the
database. We may want to protect the database from unauthorized
access. The term
refers to the protection of the database secondly
against unauthorized access, either intentionally or
accidental

7. Support for data communication


A DBMs must be capable of integration with communication software. Most users access the
database from workstations. Sometimes these workstations are connected directly to the
computer hosting the DBMs. In other cases, the workstations are at remote location and
communicate with the computer hosting the DBMs over a network.
In either case, the DBMs
receive requests as communications messages and respond in a similar way. All such
transmission are handled by a Database Communication Manager (DCM). Although the D°M is
not part of the DBMS, it is necessary for the DBMs to be capable of being integrated with a

Notes Prepared by Ms. Peninah J. Limo Page 2


variety of DCM if the system is to be commercially viable. Even DBMs for personal computers
be capable of being centralized datahuse can be
should run on a local areanetwork that
so one
established for users to share, rather than having a sense of disparate databases, one for cach
user. This does not imply that the database has to be distributed across the network rather that

user should be able to access a centralized database from remote locations.

8. Integrity services

A DBMs must furnish a means to ensure that both data in the database and changes to the data
follow certain rules.

Database integrity refers to the correctness and consistency of stored data. It can be considered as
another type of database protection. While integrity is related to security, it has wider
implications: integrity is concerned with the quality of data itself. Integrity is usually expressed
in terms of constraints which are consistency rules that the database is not permited to violate

9. Serviceto promote dataindependence


Data independence is normally achieved through a view or subschema mechanism. Physical data

independence is easier to achieve there are usually several types of changes that can be made lo
the physical characteristics ofthe database without affecting the views. However, complete
logical data independence is more difficult to achieve the addition of a new entity, attribute, or
relationship can usually be accommodated. but not their removal,. In some systems any type of
change to an existing component in the logical structure is prohibited.

10. Urilityservices
A DBMS should provide a set of utility services. Utility programs help the DBA to administer
the database effectively. Some utilities work at the external level and consequently can be
DBA. Other utilities work at the internal level and can be provided by the
produced by the
DBMs vender. Examples:

Monitoring facilities to monitor database usage and operation


Statistical analysis programs to examine performance or usage statistics
Index reorganization facilities to reorganize indexes and their overflow.

Notes Prepared by Ms. Peninah J. Limo Page 3


DATABASE ARCHITECTURE
Most commercial DBMs available today is based on ANSI-SPARK architecture

ANSL-SPARK THREE LEVEL ARCHITECTURE


User 1 user 2 user 3

External level
View View 2 View 3

Conceptual level
Conceptualschema

Internal level
Internal schema

Physical data
organization
Database

The objective of the three level architecture is to


separate each user's view of the database from
the way the database is physically represented. There are several reasons
why the separation is
desirable:
Each should be able to access the same data but have a customized view of data.
user

Each user should be able to change the


way he or she views the data and the change
should not affect other users.
Users should not have to deal with physical database storage details suçh as indexing or
hestinmg. In other words, a user's interaction with the database should be independent of
storage consideration.
The database administrator (DBA) should be able to change the database storage
structurewithout affecting the user's views.
The intermal structure of the database should be unaffected
by changes to the physical
aspects of storage, such as change over to a new storage device.

Notes Prepared by Ms. Peninah J. Limo Page 4


The DBAshould be able to change the conceptual structure of the database wthout
affecing all users.

External Level
The user's of these database. This level database that part of the database is relevat to each ser

The external level consists of a number of different external views of the datahase. Each user bas
a view of the real world represented in a form that is familiar for that user. The exterma e .
includes only those entities, attributes and relationships that are not of interest may be pres
in the database, but the user will be unaware of them.

In addition, different views have different representation of the same data For exapie. one

may view dates in the form (day ,month, and year.). while another may view danes (er.
month, and day).

Conceptual Level
The community view of database. This level describes what data is stored in the danahase and
the relationship among the data.

This level contains the logical structure of the entire database as seen by the DBA. It is a
complete view of the data requirements of the organization that is independent of any soage
considerations. The conceptual level represents:

. All entities, their attributes, and their relationships.


T h e constraints on the data.
Sensible information about the data.
Security and integrity information.

The conceptual level supports each external view, in that any data available to a user must be
contained in, or derivable from, the conceptual level. However this level must Dot contain any
storage dependent details. For instance, the description of an entity should contain only data
type's attributes (for example, INTEGER,REAL. CHARACTER). but not any storage
considerations such as the number of bytes occupied.

Internal Level
The physical representation of the database on the database on the computer. This level descnbes
how the data is stored in the database.

The internal level covers the physical implementation of the database to achieve optional run
time performance and storage space utilization. It covers the data structure and fits organizations
used to store data on storage devices. It interfaces with the operating systems access methois

Notes Prepared by Ms. Peninah J. Limo Page 5


data records) to place the data on the
tile management techniques for storing and retrieving
retrieve the data, and so on. The internal level is concerned
storage devices, build the indexes,
with such things as:

Storage space allocation for data and indexes


Recond deseriptions for storage (with stored sizes for data items)
rcord placement
Data compression and data encryption techniques.

Phgsheabt
Below the intemal level there is a physical level that may be managed by the operating system
under the direction of the DBMs. However. the function of the DBMs and the operating system
at the physical level are not clear-cut and vary from system to system. Some DBMs take
advantage of many of the operating system access methods, while others use only the most basic
ones to create their own file organizations. The physical level below the DBMs consist of items
only the operating system knows. such as exactly how the sequencing is implemented and
whether the fields of internal records are stored as contiguous bytes on the disk.

Notes Prepared by Ms. Peninah ). Limo Page 6


DATA BASE SCHEMA, MAPPINGS AND INSTANCES
The overall description ofthe database is called the database schema. There are three different
types of schema in the database and these are defined according to the levels of abstraction of
the three-level architecture.

External Schema External Schema External Schema

rna/Conceptual Logical Data

ping Independence

ESTeTnehemd
ConCohel sl Physical Data
ConceptuaVlnternal
Mapping Independence

Externat Schema

1. External Schema (sub schemas)


The External or view level includes a number of external schemes or user views. Each
external schema describes the parts of the database that a particular user group is
nterested in and hides the rest of the database from that user group.
2. Conceptualschema
The conceptual level has a conceptual schema, which describes the structure of the whole
database for a community of users. The conceptual schema hides the details of the of
physical storage structures and concentrates on describing entities, data types,
relationships, user operations, and constraints.
3. Internal Schema
The internal level has an internal schema which describes the physical stora
of the database. The internal schema uses a physical data model and describes the
complete details of the data storage and access paths for the database.

Notes Prepared by Ms. Peninah J. Limo Page 7


MAPPINGS
The process of transforming requests and results between levels are called mappings. The
DBMs is responsible for mapping between these three types of schemas. It must check
that cach 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 sehema.
The conceptual schema is related to the internal schema through a conceptual/ internal
mapping. 1This enables the DBMs to find the actual record or combination ofrecords in
physical storage that constitute logical record. It also allows any differences in entity
names, attribute names, attribute order, data types, and so on, to be resolved.

Finally, each external schema is related to the conceptual mapping. This enables the
DBMs to map names in the user's view on to the relevant part of conceptual schema.

Examples of the different levels

External view1 External View 2

SNo FName LName Age StaffNo LName BranchNo

Conceptual StaffNo FName LName DOB Salary BranchNo


Level

Internal Level Struct STAFF


Int StafiNo;
Char FNameis),
Char LnameLIS
Struct Date DateOfBirth;
Float Salary:
ox t d*/
2. Struct STAFF Next; po- t
Index StaffNo; index branchNo
nCkes t s} 7

Page 8
Notes Prepared by Ms. Peninah J. Limo
DATA INDEPENDENCE
which means
A major objective for the three-level architecture is a to provide data independence,
kinds of data
that the upper levels are unaffected by changes to lower levels. There are two
independence:
(i) Logical data independence
(i) Physical data independence

(i) Logical Data Independence


in the
Logical data independence refers to the immunity of the external schemas to changes
conceptual schema.

attributes,
Changes to the conceptual schema, such as the addition or removal of new entities,
or

schemas or having to
relationships, should be possible without having to change existing external
rewTite application programs. Clearly the user for whom the changes have
been made need to be
aware of them, but what is that other users should not be.

(i) Physical Data Independence

Physical data ind3ependence refers to the immunity of the conceptual schema to changes in the
internal schema.

Changes to the internal schema, such as using different file organizations or storage structures,
using different storage devices, modifying indexes or hasting algorithm; should be posible
without having to change the conceptual or external schemas.

Notes Prepared by Ms. Peninah J. Limo Page 9


COMPONENTS OF DATABASE
A DBMS is partitioned into several software components (or modules) each of which is
stored on disk.
assigned a specific operation. The database and the DBMS catalog are usually
of the
Access to the disk is controlled primarily by the operating system some of the functions
DBMS are supported by the underlying operating system however the operating system only
of a
provides only basic services and the DBMS must be built on top of it. Thus the design
DBMS must take into account the interface between the DBMS and the operating system. Ihe

functional components of a database system can be broadly divided into the storage manager
and the query processor components. The Major software components in a DBMS is depicted in

figure below.

naive users sophisticated database


(tellers, agents, application users administrator
Programmerss
web-users) (analysts)
use write ise use

application application query administration


interfaces programs tools tools

compiler and
linker DMLqueries DDL interpreter

application
Program DML compiler
object code and organizer

query evaluation
engine
query processor

buffer manager fie manager authorization transaction


and integrity
manager
manager

storage manager

indices data dictionary disk storage

data statlstical data

Notes Prepared by Ms. Peninah J. Limo


Page 10
QUER) PROCESSOR COMPONENT

queries into a series of low level instructions. It is used to


The quer Neessor transforms user

it into an efficient series of operations in a form


nterwet the online user's qucry and convert
anahle f being the run time data manager for execution. The query processor uses the
sent to
iata ditionary to find the structure of the relevant portion of the database and uses this
infonmation in modilying the query and preparing and optimal plan to access the database. The
e y P'ncessor Components include:

DDL intcrpreter- interprets DDL statements and records the definitions in the data
dictionary
DML compiler - translates DML statements in a query language into evaluation plan
consisting of low-level instructions that the query evaluation engine understands. A
query can usually be translated into any of a number of alternative evaluation plans that
all give the same result.

The DML compiler performs query optinmization that is it picks the lowest cost
evaluation plan from among the alternatives.

.Query evaluation engine - executes low-level instructions generated by the DML

compiler.

STORAGE MANAGER COMPONENT


A storage manager is a program module that provides the interface between the low level data
stored in the database and the application programs and queries submitted to the system. The
age manager is responsible for the interaction with the file manager. The raw data are stored
on the disk using the file system, which is usually provided by a conventional
operating system.
The storage manager translates the various DML statements into low level file system
commands. Thus, the storage manager is responsible for storing, retrieving and updating data in
the database.

The major software components for the database manager are as follows:

Transaction Manager: This module performs the required processing of operations it


receives from transactions.
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..

Authorization and integrity manager: Authorization module checks that the user has the
necessary authorization to carry out the required operation while Integrity checker

Notes Prepared by Ms. Peninah J. Limo


Page2
module checks that the requestcd operation satislies all necessary integrity cOnstraints
such as key constraints.
Buffer Manager: It is responsible for teteching data lrom disk storage into main memory
A buffer is an arca into which a block rom the file is read. The recovery manager and the

butler manager are sometimes known as the cache manager


from disk. The requesting
Programs call on the buffer manager when they needa block
is already present in the
program is given the address of the block in main memory, if it
bufler
buffer. If the block is not in the buffer the buffer manager allocates space in the
for the block replacing some of other block if required to make space lor new block.
Once space is allocated in the bufler, the buffer manager reads in the block from the disk
to the bufier and passes of the block in main memory to thhe requester.
Ihe management of buflers has the objective of maximizing the performance or the
utilization of the secondary storage systems while at same time keeping the demand on
CPU resources tolerably low. The use of two or more bulfers for a tile allows the traster
of data to be overlapped with the processing of data.

File Manager: The tile manager manipulates the underlying storage liles and manages
the allocation of storage space on disk. It establishes and maintains the list of structures
and indexes defined in the internal schema. If hashed files are used it calls on hashing
funetions to generate record addresses. However, the file manager does not directly
manage the physical input and output of data. Rather it passes the requests on to the
appropriates access methods, which either read data from or wite data into the system
buffer (or cache).
Command Processor: Once the system has checked that the user has authority to carry
out the operation, control is passed to the command
processor
Query Optimizer: This moduledetermines-an optimalstrategy torthequeryCxeculion
.Scheduler: This module is responsible for esuring that concurrent operations on the
database proceed without conflicting with one another. It controls the relative order
in
which transaction operations are executed.

DATA DICTIONARY
A data dictionary also known
as a system
catalog is a centralized store of information about thc
database. It contains information about the tables, the
attributes the tables contain, data types,
primary keys, indexes, the joins which have been established between those tables
integrity, cascades update, cascade delete etc. referential1
INDICES
Indices provide fast access to data
item that hold particular values. An index is
values which give the order of the a list of numerical
records when they are sorted on a particular
of the table. attribute/column
Notes Prepared by Ms. Peninah J. Limo
Page12
STEPS OF QUERY PROCESSING
. When a query is submitted to the database, it is received by the query compiler. It then
scans the query and divides it into individual tokens. Once the tokens are generated, they
are verified for their correctness by the parser.
2. Then the tokenized queries are transformed into different possible relational expressions,
relational trees and relational graphs (Query Plans).
3. Query optimizer then picks them to identify the best query plan to process. It checks in
the system catalog for the constraints and indexes and decides the best query plan. It
generates different execution plans for the query plan.
4. The query execution plan then decides the best and optimized execution plan for
execution.
5. The command processor then uses this execution plan to retrieve the data from the
database and returns the result.

Notes Prepared by Ms. Peninah J. Limo

You might also like