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

Dbms Unit II

Uploaded by

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

Dbms Unit II

Uploaded by

sandhya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

UNIT-II

Syllabus
Database system concepts and architecture: Schema and instances, three schema architecture of
DBMS, Data independence, database languages and interfaces, database system environment,
classification of DBMS.

Database Instance & Schema


 Database change over time as information is inserted and deleted. The collection of
information stored in the database at a particular moment is called an instance of the
database or database state or snapshot.
 The overall design of the database is called the database schema. A schema is a collection
of named objects. Schemas provide a logical classification of objects in the database. A
schema can contain tables, views, triggers, functions, packages, and other objects.
 Most data models have certain conventions for displaying schemas as diagrams. A displayed
schema is called a schema diagram.

The diagram displays the structure of each record type but not the actual instances of records. We
call each object in the schema-such as STUDENT or COURSE-a schema construct.

The distinction between database schema and database state is very important.
 When we define a new database, we specify its database schema only to the DBMS. At this
point, the corresponding database state is the empty state with no data.

 We get the initial state of the database when the database is first populated or loaded with the
initial data.

 From then on, every time an update operation is applied to the database, we get another
database state. At any point in time, the database has a current state.

1
UNIT-II
 The DBMS is partly responsible for ensuring that every state of the database is a valid state -
that is, a state that satisfies the structure and constraints specified in the schema.
 Hence, specifying a correct schema to the DBMS is extremely important, and the schema
must be designed with the utmost care.
The DBMS stores the descriptions of the schema constructs and constraints-also called the
metadata - in the DBMS catalog so that DBMS software can refer to the schema whenever it needs
to.
The schema is sometimes called the intension, and a database state an extension of the schema.

Need for Abstraction


 The main objective of DBMS is to store and retrieve information efficiently; all the users
should be able to access same data.
 The designers use complex data structure to represent the data, so that data can be efficiently
stored and retrieved, but it is not necessary for the users to know physical database storage
details.
 The developers hide the complexity from users through several levels of abstraction.

Levels of Data Abstraction (Three Schema Architecture)


The goal of the three-schema architecture, is to separate the user applications from the physical
database. In this architecture, schemas can be defined at the following three levels:

1. The internal level has an internal schema, which describes the physical storage structure of the
database. The internal schema uses a physical data model and describes the complete details of
data storage and access paths for the database.

2. 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 physical storage
structures and concentrates on describing entities, data types, relationships, user operations, and
constraints. Can be described using either high-level or implementational data model.

3. The external or view level includes a number of external schemas or user views. Each
external schema describes the part of the database that a particular user group is interested in

2
UNIT-II
and hides the rest of the database from that user group. Can be described using either high-level
or implementational data model (Usually uses the same data model as the conceptual schema).

Data Independence
Data independence means the internal structure of database should be unaffected by changes
to physical aspects of storage. Because of data independence, the Database administrator can
change the database storage structures without affecting the users view.

1. Logical Data Independence:


Means that the overall logical structure (conceptual schema) of data may be changed without
changing the application programs. We may change conceptual schema to
- Expand the database (adding record type or data item)
- To change constraints
- To reduce the database (removing record type or data item)

2. Physical Data Independence:


Physical Data independence means that the physical layout (internal schema) and the
organization of data may be changed without changing the overall logic structure(conceptual schema)
of data or the application programs. The external schemas need to be changed as well. The changes
to the internal schema may be needed because some physical files were reorganized.

Data independence is accomplished because, when the schema is changed at some level, the
schema at the next higher level remains unchanged; only the mapping between the two levels is
changed.

DBMS Languages
Three are basically two types of languages used in DBMS, viz, front-end and back-end languages.
Back-end is used for the design of storage structure whereas, front-end is used for designing user
interface. Examples of front-end languages are Visual Basic, VB .Net, JAVA etc. Examples of back-
end are, MS Access, PL/SQL, Oracle etc. These two types are also referred to as Data Definition
Language (DDL) and Data Manipulation Language (DML)

DDL is used to design the conceptual schema at the conceptual level. DDL can be of two types,

3
UNIT-II
 Structure Definition Language (SDL) and
 View Definition Language (VDL).

SDL is normally used to design the tables and VDL is used to create views as per the user queries.
Oracle is an example of DDL which is used as both SDL and VDL.

DML is used at the external level. These languages are used to map the user queries to the
database. There are two types of DML.

 Procedural or Low level DML and


 Non-procedural or High level DML.

Low level DML are called record – at – a – time languages and high level DML are set – at – a –time
languages.

Apart from these languages; there also exist high level Query Processing Languages. In most of the
modern DBMS on languages serves all purpose of DBMS, including, designing, interfacing and query
processing.

DBMS Interfaces
1. Menu-based Interfaces: List of options is displayed in the form of drop down menus so that
user can select the required option. It is text based interface. These are popular web based
user interfaces which are also referred to as browsing interfaces. Examples are web search
engines (Google).

2. Forms-based Interfaces: For each module in the DBMS there will be a form. User will have
to fill the information in the text boxes or through the check boxes or option buttons. Form
specific languages may be used to create such type of interfaces ( eg. VB). Examples of form
based interfaces are applications like e-Granthalaya.

3. Graphical User Interfaces (GUI): These are also normally found in web applications. Instead
of drop down menus user will have pictures or graphics displayed for specific option. User will
have to select the desired one. These interfaces are more colorful and easy-to-use type. Many
commercial web sites are GUI based. (Example: web-pages of Amazon, Flipkart etc.).

4. Natural Language Interfaces: These interfaces accept the queries in local languages. The
query processors may work using two different techniques. In first case the database is
maintained in English and a dictionary of words is maintained for the all the local languages. A
local language processor (natural language processor) is used to process the queries. Where
as in the second case the database itself is maintained in local language and local language
queries are directly processed.

5. Speech input and output: These interfaces will have a speech recognition system and
maintain a verbal dictionary. User can literally ask the queries and get the verbal answers with

4
UNIT-II
some extra hardware devices for speech input and output. These interfaces are of great help
for visually challenged users.

6. Interfaces for Parametric users: DBMS used in banks or in supermarkets will have their own
specific interface for specific use. There will be repeated set of operations to be done and the
operator (parametric user) will have easy access to them by a key-press or a mouse-click.

7. Interface for DBA: This may include the commands to create the user accounts, provide the
authorization, change the parameters and schema design if needed etc.

THE DATABASE SYSTEM ENVIRONMENT

A DBMS is a complex software system. The environment is about the types of software components
that constitute a DBMS and the types of computer system software with which the DBMS interacts.

DBMS Component Modules:

Typical DBMS components in below figure are divided into two parts. The top part of the figure refers
to the various users of the database environment and their interfaces. The lower part shows the
internals of the DBMS responsible for storage of data and processing of transactions.

 The database and the DBMS catalog are usually stored on disk. Access to the disk is
controlled primarily by the operating system (OS), which schedules disk input/output.
 A higher-level stored data manager module of the DBMS controls access to DBMS
information that is stored on disk, whether it is part of the database or the catalog.
 If we consider the top half of the figure, It shows interfaces to DBA staff, casual users,
application programmers and parametric users.
 The DDL compiler processes schema definitions, specified in the DDL, and stores the
description of the schema in the DBMS Catalog. The catalog includes information such as
names and sizes of the sizes of the files, data types of data of data items. Storage details of
each file, mapping information among schemas and constraints.
 The runtime database processor handles database accesses at runtime; it receives retrieval
or update operations and carries them out on the database. Access to disk goes through the
stored data manager, and the buffer manager keeps track of the database pages in memory.
 The query compiler handles high-level queries that are entered interactively. It parses,
analyzes, and compiles or interprets a query by creating database access code, and then
generates calls to the runtime processor for executing the code.
 The pre-compiler extracts DML commands from an application program written in a host
programming language. These commands are sent to the DML compiler for compilation into
object code for database access. The rest of the program is sent to the host language
compiler.
 The object codes for the DML commands and the rest of the program are linked, forming a
canned transaction whose executable code includes calls to the runtime database
processor.

5
UNIT-II
 It is now common to have the client program that accesses the DBMS running on a separate
computer from the computer on which the database resides. The former is called the client
computer, and the latter is called the database server. In some cases, the client accesses a
middle computer, called the application server, which in turn accesses the database server.

Database System Utilities


Most DBMSs have database utilities that help the DBA manage the database system. Common
utilities have the following types of functions:

1. Loading. A loading utility is used to load existing data files—such as text files or sequential
files—into the database. Usually, the current (source) format of the data file and the desired
(target) database file structure are specified to the utility, which then automatically reformats
the data and stores it in the database.

2. Backup. A backup utility creates a backup copy of the database, usually by dumping the
entire database onto tape or other mass storage medium. The backup copy can be used to
restore the database in case of catastrophic disk failure.

6
UNIT-II
3. Database storage reorganization. This utility can be used to reorganize a set of database
files into different file organizations, and create new access paths to improve performance.

4. Performance monitoring. Such a utility monitors database usage and provides statistics to
the DBA.

Centralized and Client/Server Architectures for DBMSs


Centralized database system consist of a single processer together with it associated data storage
devices and other peripherals. It is physically confined to a single location. The data can be accessed
from the multiple sites with the use of a computer network while the database is maintained at the
central site.

Disadvantages

o When the central site computer or database system goes down, then everyone is blocked
from using the system comes back.
o Communication costs from the terminals to the central site can be expensive.

Client / Server DBMS:


Client/ Server architecture of database systems has two logical components namely client and server.
 A client in this framework is typically a user machine that provides user interface capabilities
and local processing. When a client requires access to additional functionality— such as
database access—that does not exist at that machine, it connects to a server that provides
the needed functionality.

 A server is a system containing both hard-ware and software that can provide services to the
client machines, such as file access, printing, achieving, or database access.

7
UNIT-II
Two main types of basic DBMS architectures were created on this underlying client/server
framework: two-tier and three-tier.

Two-Tier Client/Server Architectures

Two-Tier Client/Server Architectures is used for User Interface program and Application Programs
that runs on client side. An interface called ODBC(Open Database Connectivity) provides an API that
allow client side program to call the DBMS. Most DBMS vendors provide ODBC drivers. A client
program may connect to several DBMS's. In this architecture some variation of client is also possible
for example in some DBMS's more functionality is transferred to the client including data dictionary,
optimization etc. Such clients are called Data server.

Three-tier Client / Server database architecture


Three-tier Client / Server database architecture is commonly used architecture for web applications.
Intermediate layer called Application server or Web Server stores the web connectivity software and
the business logic(constraints) part of application used to access the right amount of data from the
database server. This layer acts like medium for sending partially processed data between the
database server and the client.

8
UNIT-II

Classification of Database Management Systems


Database Management Systems are classified based on various parameters. We discuss the
following classifications based on,

 Data model – DBMS is classified as


 Relational data model DBMS – used in most of the commercial applications
 Network data model DBMS – used in private organizations
 Hierarchical data model DBMS – used in Banks, Government firms etc.
 Object data model DBMS – used in commercial applications but not wide
spread.
 Number of Users
 Single user DBMS systems – used by a single person maintained in an
autonomous system or through internet
 Multi-user DBMS systems – used by number of users in a networked
environment using LAN or WAN
 Number of sites over which database is distributed
 Centralized DBMS – Here, database and DBMS are stored in a single
computer but are shared by multi-users.
 Distributed DBMS – Here, both database and DBMS may be stored in more
than one computer systems using distributed network.
 Software used on multiple sites
 Homogeneous DBMS – uses same front end and back end softwares at all the
multiple sites
 Heterogeneous DBMS – may use different front end and back end software at
different sites.
 Cost - Low cost systems, High-cost and free DBMS systems.
 Types of Access paths – Option given for storing the files.
 Purpose

9
UNIT-II
 Special purpose DBMS – designed for a specific application which can be used
by only one type of applications. For example, Banking, Air-line reservation
systems etc.
 General purpose DBMS – designed in such a way that, with slight modifications
this software may be used by different applications. Examples are Office
management systems, shopping invoice systems etc.

10

You might also like