85
Data Base Management System [DBMS] Chapter 1 Unit I Aruna (DSCASC) 1

Dbms ii mca-ch1-ch2-intro-datamodel-2013

Embed Size (px)

Citation preview

Data Base Management System[DBMS]

Chapter 1Unit I

Aruna (DSCASC) 1

Introduction

A Database Management System (DBMS) is a collection of programs or software package that enables users to create and maintain a database.

Defining a database involves specifying the data types, structures, and constraints of the data to be stored in the database.

*

*

Aruna (DSCASC) 2

File Management Systems

• Uncontrolled Redundancy• Inconsistent data• Limited data sharing• Difficulty in accessing data• Security problems• Huge data storage problem• Excessive program maintenance• Excessive data maintenance

Aruna (DSCASC)

Drawbacks

3

File Processing Systems

Aruna (DSCASC) 4

Duplicate Data

– Data redundancy and inconsistency• Redundancy: Duplication of information in different files. (the same data are stored in many different locations is known as Data

Redundancy.)

• Inconsistency: Same data with different formats (this happen because the update are not properly done at all places.)

– Integrity problems• Data integrity is the assurance that data is correct and consistent--that the data

correctly reflects the "real" world. • Integrity constraints (e.g. account balance > 0) • Hard to add new constraints or change existing ones.

– Atomicity of updates• Failures may leave database in an inconsistent state with partial updates carried

out. Example: Transfer of funds from one account to another should either complete or

not happen at all.

Disadvantages of File Processing

Aruna (DSCASC) 5

– Difficulty in accessing data • Need to write a new program to carry out each new task.

– Concurrent access by multiple users• Uncontrolled concurrent accesses can lead to inconsistencies.• Example: Two people use the data and updating it at the same time.

– Security problems• Hard to provide user access to some, but not all, data.

Disadvantages of File Processing (Cont.,)

Aruna (DSCASC) 6

• Data: Meaningful facts, text, graphics, images, sound, video segments.

• Database: An organized collection of logically related data.

• Information: Data processed to be useful in decision making.

• Metadata: Data that describes data. [The database definition or descriptive information is also stored by the DBMS in the form of a database catalog or dictionary; it is called meta-data]

• Database Management System (DBMS): A software package/ system to facilitate the creation and maintenance of a computerized database.

(OR) a collection of programs and tools to create & maintain a database.

• Database System: The DBMS software together with the data itself. Sometimes, the applications are also included.

DefinitionDBMS

Aruna (DSCASC) 7

• Define a database: In terms of data types, structures and constraints. Construct or Load the Database on a secondary storage medium.

• Manipulating the database : Query, generating reports, insertions, deletions and modifications to its content.

• Concurrent Processing and Sharing by a set of users and programs – yet, keeping all data valid and consistent.

• Protection or Security measures to prevent unauthorized access.

Typical DBMS Functionality

Aruna (DSCASC) 8

Database system Environment

Users/Programmers

Application Programs/Queries

Software to Process Queries / Programs

Software to Access Stored Data

DBMS Software

Database System

Stored Database Definition

(Metadata)

StoredDatabase

Aruna (DSCASC) 9

DBMS manages data resources like an operating system manages hardware resources

DBMSDBMS Databasecontainingcentralized

shared data

Application#1

Application#2

Application#3

Database Management System

Aruna (DSCASC) 10

Database Management System Approach

• Controlled Redundancy– consistency of data &

integrity constraints• Integration of data

– self-contained & represents semantics of application

• Data and operation sharing– multiple interfaces

• Services & Controls– security & privacy

controls – backup & recovery– enforcement of

standards• Flexibility

– data independence– data accessibility– reduced program

maintenance• Ease of application

developmentAruna (DSCASC) 11

What is a Database Management System?

A collection of programs and tools to create and maintain a Database.

• Defining: Specifying types of data

• Constructing: Storing

• Manipulating: Querying, Updating, Reporting

Aruna (DSCASC) 12

Example of Database

UNIVERSITY DATABASE

• Information about students, courses, and grades in a university are gathered.

• To construct the UNIVERSITY database, we store data to represent each student, course, section, grade report, and prerequisite as a record in the appropriate file.

• To define the database, we must specify the structure (metadata) of the records of each file by specifying the different types of data elements to be stored in each record.

Aruna (DSCASC) 13

Description: Properties or characteristics of the data, including data types, field sizes, allowable values, and documentation

Metadata

Name Type Length Min Max Description

Name Alphanumeric 30 Student Name

Student Number

Integer 1 1 9 Student No

Class Alphanumeric 15 Class

Major Alphanumeric 15 Major

STUDENT

Aruna (DSCASC) 14

A database that stores student and course information

Name Student_number Class Major

Smith 17 1 CS

Brown 8 2 CS

1) STUDENT

Course_name Course_number Credit_hours Department

Intro to Computer Science CS1310 4 CS

Data Structures CS3320 4 CS

Discrete Mathematics MATH2410 3 MATH

Database CS3380 3 CS

2) COURSE

Course_number Prerequisite_number

CS3380 CS3320

CS3380 MATH2410

CS3320 CS1310

3) PREREQUISITE

15

A database that stores student and course information (Cont---)

Section_identifier Course_number Semester Year Instructor

85 MATH2410 Fall 07 King

92 CS1310 Fall 07 Anderson

102 CS3320 Spring 08 Knuth

112 MATH2410 Fall 08 Chang

119 CS1310 Fall 08 Anderson

135 CS3380 Fall 08 Stone

4) SECTION

5) GRADE_REPORT

Student_number Section_identifier Grade

17 112 B

17 119 C

8 85 A

8 92 A

8 102 B

8 135 A16

Applications of Database System

• Banking• Airlines• University• Railways• Finance• Sales• Telecommunication• Pay roll system• Manufacturing

Aruna (DSCASC) 17

Characteristics of the Database Approach

• In file processing, each user defines and implements the files needed for a specific software application as part of programming the application.

For example:

• One department, the grade reporting office, may keep files on students and their grades.

• A second department, the accounting office, may keep track of students fees and their payments.

• Third department, library, keeps track of students details and borrowing of books.

Aruna (DSCASC) 18

• All these departments are interested in data about students, each department maintains separate files— and programs to manipulate these files.

• In file processing, redundancy of data and storing data results in wasted storage space.

• In the database approach, a single repository maintains data that is defined once and then accessed by various users.

Characteristics of the Database Approach

Aruna (DSCASC) 19

Characteristics of the Database Approach

– Self-describing nature of a database system.

– Insulation between programs and data, and data abstraction.

– Support of multiple views of the data.

– Sharing of data and multiuser transaction processing.

Aruna (DSCASC) 20

1) Self-describing nature of a database system:

* The database system contains not only the database itself but also a complete

definition or description of the database structure and constraints.

* A DBMS catalog stores the description or definition of the database. ( i.e., it contains information such as the structure of each file, the type and storage format of each data item, and various constraints on the data)

* The description stored in the catalog is called meta-data.

* The Software or programs must work equally well with any number of database applications as long as the database definition is stored in the catalog.

* It can access the database by extracting the DB definitions from the catalog and then using these definitions.

Characteristics of the Database Approach

Aruna (DSCASC) 21

2) Insulation between programs and data:

• In file processing, the structure of data files is embedded in the application programs, so any changes to the structure of a file may require changing all programs that access that file.

• In DBMS access programs do not require such changes in most cases.

• The structure of data files is stored in the DBMS catalog separately from the access programs.

• We call this property program-data independence.

• The characteristic that allows program-data independence and program-operation independence is called data abstraction. (OR A data model is used to hide storage details and present the users with a conceptual view of the database.)

Characteristics of the Database Approach

Aruna (DSCASC) 22

3) Support of multiple views of the data:

Each user may see a different view of the database, which describes only the data of interest to that user.

4) Sharing of data and multi-user transaction processing :

Allowing a set of concurrent users to retrieve and to update the database.

Concurrency control within the DBMS guarantees that each transaction is correctly executed or completely aborted.

Example: Airlines Reservation

• These types of applications are generally called online transaction processing (OLTP) applications.

Characteristics of the Database Approach

Aruna (DSCASC) 23

Users may be divided into –

“Actors on the scene” - Those who actually use and control the content.

“Workers behind the scene” - Those who enable the database to be developed and the DBMS software to be designed and implemented.

Database Users

Aruna (DSCASC) 24

– Database administrators (DBA): Responsible for authorizing access to the database, for

co-coordinating and monitoring its use, acquiring software, and hardware resources, controlling its use and monitoring efficiency of operations.

Functions of DBA:» Defining the conceptual schema.» Defining the physical schema.» Defining the security and Integrity constraints.» Defining Backup and Recovery procedures.» Storage structures and access methods definition.» Granting of authorization for data access.

Actors on the scene

Aruna (DSCASC) 25

– Database Designers: Responsible to define the content, the structure, the

constraints, and functions or transactions against the database. They must communicate with the end-users and understand their needs.

– End-users: They use the data for queries, reports and some of them actually

update the database content.

Actors on the scene

Aruna (DSCASC) 26

Different types of end users:1) Casual: Access database occasionally when needed

2) Naïve or Parametric: They make up a large section of the end-user population. They use previously well-defined functions in the form of “canned transactions” (using

Queries and Updates) against the database. OR

Users who interact with the system by using the application programs that have previously written, they are unsophisticated users.

Examples A bank-tellers or reservation clerks who do this activity for an entire shift of operations.

Categories of End-users

Aruna (DSCASC) 27

Sophisticated: - These include business analysts, scientists, engineers, others thoroughly familiar

with the system capabilities. - Many use tools in the form of software packages that work closely with the stored

database. - This users interact with the system without writing programs. Instead they form

their database query.

Stand-alone: Mostly maintain personal databases using ready-to-use packaged applications. An

example is a tax program user that creates his or her own internal database

Categories of End-users

Aruna (DSCASC) 28

• DBMS System Designers & Implementers: Persons who design and implement the DBMS modules &

interface as a software package.

• Tool Developers: Person who design and implement tools . They are optional packages. Packages for:

* DB design. * Performance tuning / monitoring. * Graphical Interfaces.

* Simulation. *Test data generation.

• Operators and Maintenance Personnel: The System Administrator personnel who are responsible for the

actual running and maintenance of the hardware and software environment for the database system.

Workers behind the Scene

Aruna (DSCASC) 29

Aruna (DSCASC) 30

• Program-Data Independence – Metadata or definition is stored in the Data Dictionary or System catalog , so

applications don’t need to worry about data formats.– Data queries/updates managed by DBMS so programs don’t need to process data

access routines.

• Minimal Data Redundancy– Leads to increased data integrity/consistency.

• Improved Data Sharing– Different users get different views of the data.

• Enforcement of Standards– All data access is done in the same way.

Advantages of Database Approach

Aruna (DSCASC) 31

• Improved Data Quality – Constraints, data validation rules.

• Better Data Accessibility/ Responsiveness– Use of standard data query language (SQL)

• Security, Backup/Recovery, Concurrency– Restricting unauthorized access– Disaster recovery is easier The recovery system should see that the database is restored back to its

initial state (ie., The stage before starting the execution). The system must provide automatic backup facilities in order to avoid power failure problem.

Advantages of Database Approach (Cont.,)

Aruna (DSCASC) 32

Historical Development of Database Technology• Early Database Applications:

– The Hierarchical and Network Models were introduced in mid 1960s and dominated during the seventies.

– A bulk of the worldwide database processing still occurs using these models, particularly, the hierarchical model.

• Relational Model based Systems:

– Relational model was originally introduced in 1970, was heavily researched and experimented within IBM Research and several universities.

– Relational DBMS Products emerged in the early 1980s.

Aruna (DSCASC) 33

Historical Development of Database Technology (cont.,)

• Object-oriented and emerging applications:

– Object-Oriented Database Management Systems (OODBMSs) were introduced in late 1980s and early 1990s to cater to the need of complex data processing in CAD and other applications.

• Their use has not taken off much.

– Many relational DBMSs have incorporated object database concepts, leading to a new category called object-relational DBMSs (ORDBMSs)

– Extended relational systems add further capabilities (e.g. for multimedia data, XML, and other data types)

Aruna (DSCASC) 34

Historical Development of Database Technology (cont.,)

• Data on the Web and E-commerce Applications:

– Web contains data in HTML (Hypertext markup language) with links among pages.

– This has given rise to a new set of applications and E-commerce is using new standards like XML (eXtended Markup Language).

– Script programming languages such as PHP and JavaScript allow generation of dynamic Web pages that are partially generated from a database

• Also allow database updates through Web pages.

Aruna (DSCASC) 35

When not to use a DBMS

• Main inhibitors (costs) of using a DBMS:

– High initial investment and possible need for additional hardware.

– Overhead for providing generality, security, concurrency control, recovery, and integrity functions.

• When a DBMS may be unnecessary:

– If the database and applications are simple, well defined, and not expected to change.

– If there are stringent real-time requirements that may not be met because of DBMS overhead.

– If access to data by multiple users is not required.Aruna (DSCASC) 38

When not to use a DBMS

• When no DBMS may suffice:

– If the database system is not able to handle the complexity of data because of modeling limitations

– If the database users need special operations not supported by the DBMS.

Aruna (DSCASC) 39

Database System Conceptsand Architecture

Data ModelsChapter 2

Aruna (DSCASC) 40

Data Models, Schemas, and Instances

• A data model—a collection of concepts that can be used to describe the structure of a database.

OR Data Model is important to distinguish between the description of

the database and the data itself.

• Structure of a database means the data types, relationships, and constraints that apply to the data.

• A data models also include a set of basic operations for specifying retrievals and updates on the database.

Aruna (DSCASC) 41

43

– Conceptual data models (High-level, semantic)

– Physical data models (Low-level, internal)

– Implementation data models (Representational)

Categories of data models

Aruna (DSCASC)

Aruna (DSCASC) 44

1) Conceptual data models (high-level, semantic):

• Provide concepts that are close to the way many users perceive (recognize) data.

(Also called Entity-Relational or object-based data models.)

• Conceptual data models use concepts such as entities, attributes, and relationships.

• An entity represents a real world object or concept such as employee or a project.

• An attribute represents some property.

• A relationship among two or more entities .

Categories of data models

2) Physical data models (low-level, internal):

• Physical data models describes how data is stored in the computer by representing information such as record formats, record orderings and access path.

• An access path is a structure that makes the search for particular database

records efficient.

• Meant for computer specialists not for end users.

• An access path is a structure that makes the search for particular database records.

Aruna (DSCASC) 45

Categories of data models (cont.,)

3) Implementation (representational) data models:

• Provide concepts that fall between the above two, balancing user views with some computer storage details.

• Network and hierarchical models are used .

• Representational data model represents data by using record structures and hence are sometimes called record based data models.

46

Categories of data models

Aruna (DSCASC)

47

History of Data Models

• Network Model• Hierarchical Model• Entity – Relationship Model • Relational Model• Object-Oriented Model• Object-Relational Model

Aruna (DSCASC)

• Entity –Relationship Model

The E-R data model is based on real world that consists of a collection of basic objects called entities and relationship among the objects.

– Entities are specific objects or things in the world that are represented in the database.

Example: specific person, company, student, event.

– Attributes are properties used to describe an entity. Example: an EMPLOYEE entity may have a Name, SSN, Address, Designation, Salary.

48

Data Models

Aruna (DSCASC)

49

Data Models

Entity – Relationship Model

Aruna (DSCASC)

50

Data Models1) Relational Model: - It represents a database as a collection of tables (Where each table can be stored as a separate file, each of which has a number of columns with unique names).

- A table is a collection of rows and columns. Each column has a unique name.

- Each row is called a tuple, a column header as attributes, the table as relation.Example:

NAME LOCATION CITY PHONE NO. ACCOUNT No.

ANAND KORAMANGALA BANGALORE 534278 401

VIKRAM AUDOGODI BANGALORE 546678 402

ACCOUNT NO. BALANCE

401 10000

402 5000

Advantage & Disadvantage of Relational model

Advantages:• Simplicity: A relational data model is simple than hierarchical and

network model.• Structure independence: This model does not depend on the

navigational data access system.

Disadvantages:Hardware overheads: This model needs more powerful computing hardware

and data storage devices to perform RDBMS assigned task

Aruna (DSCASC) 51

52

Data Models

2) Network Model: Data is represented as a collection of records and relationship between

data is represented by links which can be viewed as pointers. The record in the database are organized as collection of arbitrary graphs.

Example:

Publisher

Book

Author

Book Branch Branch

Network database structure

Network database modelAruna (DSCASC)

Advantages

• Simplicity: Similar to hierarchical data model, network model is also simple and easy to design.

• Superior data access: The data access and flexibility is superior to that is found in the hierarchical data model.

• Database integrity: Network model enforces database integrity.• Data independence: This model allows sufficient data independence.

Disadvantages

• System complexity: Navigation the data in this model is complex.• Not a user friendly: Highly skill oriented because use of pointers leads to complex

structure, which makes mapping of related data very difficult.

53

Advantage & Disadvantage of Network model

Aruna (DSCASC)

54

Data Models3) Hierarchical Data Model: It is different from network model in the way that records are organized into a tree like

structure.

For eg. An organization might store information about an employee, such as name, dep, sal. The organization might also store information about employee’s family. The employee and the family data forms hierarchy.

Example:

DEPT

F1 F3 F4F2

SD1 SD2 SD3 SD4

F – FacultyS - Student

Aruna (DSCASC)

Advantages• Simplicity: The relationship between various layers is logically simple and design of a

hierarchical database is simple .• Data sharing • Data Security• Data Integrity: Relationship between parent and child• Data Independence

Disadvantages• Implementation limitation: Many of the common relationships do not confirm to the

one-to-many relationship format.• Inflexibility: The change in the new relations or segments often yield very complex

system management tasks.

55

Advantage & Disadvantage of Hierarchical model

Aruna (DSCASC)

56

Data Models4) Object Oriented Data Model: It defines the database in terms of objects, their properties and their operations.

Objects with some structure and behavior.

• Support the basic elements of the object approach used in object oriented programming languages like inheritance, use of methods, and encapsulation.

• Some object-oriented databases are designed to work well with object oriented programming languages such as Java, C++, C# etc.

• OODBMS use exactly the same model as object-oriented programming languages.

Methods

Class

Operations of each class in terms of predefined procedure.

Aruna (DSCASC)

Example: class employee

{ string name; string address; int salary; int annual salary(); };

Advantages:• Improved data access.• Improved productivity: Features like inheritance, polymorphism that allow the users to

compose objects and provide solutions without writing object specific code. Disadvantage: • Difficult to maintain.• Not suited for all applications.• Hardware overheads.

57Aruna (DSCASC)

58

Data Models

5) Object Relation Data Model:

This model combines features of relational and object oriented model.

This model provides the rich types system of object-oriented databases, combines with relations as the basis for storage of data.

Object-Relational database systems provide a smooth migration path for users of relational databases who wish to use object oriented features.

For egFor eg: The data type of "location" is "geographic point" and "picture" is "image". : The data type of "location" is "geographic point" and "picture" is "image".

Aruna (DSCASC)

59

Schema: • In any data model, it is important to distinguish between the description of the database

and the database itself.

The description of a database is called Database Schema. (or) Logical structure of the database.

* A schema is an outline or a plan that describes the records and relationships existing in the view.

* A displayed schema is called a schema diagram.

* Systematic plan for attaining some goal.

* Schema is specified during the DB design and not expected to change frequently.

* The data in the DB at a particular moment in time is called a DB state or snapshot. It is also called the current set of occurrences or instances in the DB.

Schemas, Instances & Database States

Aruna (DSCASC) 60

Example: The database consists of information about a set of customers and accounts and the relationship between them.

• Schema diagram - Diagrammatic representation of the schema is known as schema diagram

Schemas, Instances & Database States

Aruna (DSCASC) 61

Schema diagram

REGNO NAME COURSENO SECTIONID

STUDENT

COURSE

COURSENO COURSENAME CREDITHOURS DEPARTMENT

SECTION

SECTIONID COURSENO SEMESTER YEAR FACULTY

REGNO SECTIONID GRADE

GRADE REPORT

A schema diagram does not displays all aspects of a database structure.

Aruna (DSCASC) 63

Instance:

The actual content (data) of the database at a particular point of time is called instance or database state.

• In a given database state each schema construct has its own current set of instance.

• Every time we insert or delete a record or change the value of a data we change one state of the database into another state.

• Three types of states Empty state, Initial State, Current State.

Empty State - When we define a new database.

Initial State – When the database is first loaded with initial data.

Current State - When an update operation is applied to the database.

Instances and Schemas

Aruna (DSCASC) 64

Instance of Students Relation (Example)

Students ( sid: string, name: string, login: string,

age: integer, gpa: real )

Instance:

sid name login age gpa

53666 Jones jones@cs 18 3.4

53688 Smith smith@ee 18 3.2

53650 Smith smith@math 19 3.8

Aruna (DSCASC) 65

The goal of the three-schema architecture is to separate the user applications from the physical database.

Defines DBMS schemas at three levels:

• Internal schema at the internal level to describe physical storage structures and access paths. Typically uses a physical data model.

(Physical schema describes the files and indexes used.)

• Conceptual schema at the conceptual level to describe the structure and constraints for the whole database for a community of users. Uses a conceptual or an implementation data model.

(Conceptual schema defines logical structure.)

• External schema at the external level or (View Level) to describe the various user views. Usually uses the same data model as the conceptual level.

(External schema describe how users see the data.)

Three-Schema Architecture

66

Three-Schema Architecture

External Level(describe the various user views)

Conceptual Level(describe the structure and constraints for the whole database)

Internal Level(physical storage structures and access paths)

END USERS

External View External View

Conceptual Schema

Internal Schema

Stored Database

. . .

Aruna (DSCASC) 67

Three-Schema ArchitectureExample:

Customer Name

Customer Address

Customer Name

Customer Address

Customer SSN

Customer Name: String

Customer Address: String

Customer SSN: Number (PK)

Name: String length 25

Address: String length 40

SSN: Number length 10

Conceptual View

Internal View

External View

Logical Record 1 Logical Record n

Customer SSN--------------

Aruna (DSCASC) 68

Data Independence: It is the capacity to change the schema at one level of database

system without having to change the schema at the next higher level.

Two types of Data Independence:

» Logical Data Independence

» Physical Data Independence

Data Independence

Types of Data Independence

• Logical Data Independence :

The ability to modify or change the conceptual (logical) schema without changing the external scheme or application programs to be rewritten.

* Modifications are necessary whenever the logical structure of the database is altered.

* The change in conceptual database may be expanding the database by adding a new data field or reducing the database by deleting fields.

Aruna (DSCASC) 69

Aruna (DSCASC) 70

• Physical Data Independence:

The ability to modify or change the internal (physical) schema without changing the Conceptual (logical) schema.

* Modifications are necessary in this level to improve the performance.

* Changes to the internal schema is needed because some physical file had to be reorganized, such as changing the access modes or paths for better retrieval or updates.

Types of Data Independence

Aruna (DSCASC) 71

Data independence is accomplished when the schema is changed at some level, the schema at the next higher level remains unchanged.

Applications heavily depend on the Conceptual (logical) schema, so logical data independence is difficult to achieve.

In general, the interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence others.

Data Independence

Database Languages

Once the design of a database is completed and a DBMS is chosen to implement the database, the first step is to specify conceptual and internal schemas for the database and any mappings between the two.

• Data Definition Language (DDL): It is used by the DBA and database designers to specify the conceptual

schema of a database.

In many DBMS, the DDL is also used to define internal and external schemas (views).

In some DBMS, separate storage definition language (SDL) and view definition language (VDL) are used to define internal and external schemas.

Aruna (DSCASC) 72

• Data Manipulation Language (DML):

• It is used to specify database retrievals and updates.

• Stand-alone DML commands can be applied directly (query language).

• High Level or Non-procedural Languages: e.g., SQL, are set-oriented and specify what data to retrieve than how to retrieve. Also called declarative languages.

• Low Level or Procedural Languages: record-at-a-time; they specify how to retrieve data and include constructs such as looping.

Aruna (DSCASC) 73

Database Languages

DBMS Interfaces

• User-friendly interfaces:

• Menu-based, popular for browsing on the web• Forms-based, designed for naïve users• Graphics-based (Point and Click, Drag and Drop etc.)• Natural language: requests in written English• Combinations of the above

Aruna (DSCASC) 74

Other DBMS Interfaces

• Speech Input and Output

• Web Browser as an interface

• Parametric interfaces (e.g., bank tellers) using function keys.

• Interfaces for the DBA:• Creating accounts, granting authorizations• Setting system parameters• Changing schemas or access path

DBMS Environment

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.

DBMS Component Modules

• Top part of the figure shows interfaces for the DBA staff:

casual users who work with interactive interfaces to formulate queries, application programmers who create programs using some host programming languages.

parametric users who do data entry work by supplying parameters to predefined transactions.

• The DBA staff works on defining the database and tuning it by making changes to its definition using the DDL and other privileged commands.

Aruna (DSCASC) 77

79

DBMS Environment• Database and the DBMS catalog are usually stored on disk.

• DDL Compiler: processes schema definitions specified in the DDL & stores descriptions of the schemas in the catalog.

• System Catalog: Includes info such as names, size of files, names and data type of data items, storage details, constraints.

• Run time DB processor: handles database accesses at runtime. It receives retrieval or update operations an carries them out on the DB.

• Stored data Manager: Controls access to DBMS information that is stored on disk.

• Pre-compiler: Extracts DML commands from an application program and sent to DML compiler.• DML Compiler: Generates object code for DB access.• Host lang compiler: Rest of the program (i.e., apart from DML commands).

80

DBMS Environment

• Interactive Query: Queries are passed, analyzed for correctness.

• Query compiler: handles high level queries that are entered interactively. Interprets and query by creating DB access code and then subjects to query optimization.

• Query optimizer: Concerned rearrangement and possible reordering, elimination of redundancies and makes calls on the runtime processor.

Aruna (DSCASC) 81

DBMS Environment

Aruna (DSCASC) 82

Client Server Architecture• The client-server architecture was developed to deal with computing

environments in which a large number of computers, workstations, file server, printers, database servers, web servers and other equipment are connected via a network.

• In client server architecture, number of personal computers, workstations, servers and printers are involved.

• Each server is assigned a specific functionality. Like printer server which connects to various printers and print

requests by the client.File server that maintains the files of the client machine.

Client Server Architecture

There are two client server framework:

1) Two tier architecture 2) Three tier architecture

Aruna (DSCASC) 83

Aruna (DSCASC) 84

Two-Tier architecture:• In two tier architecture the software components are distributed

over two systems. The client and the server.

Client Server Architecture

Client

Print Server

File Server

DBMS Server

Client Client

Logical two-tier architecture

Aruna (DSCASC) 85

Two-Tier architecture

• A client is a user machine that provides user interface and local processing.

• When a client requests, it connects to a server that provides the need.

• A server machine can provide services to the client machine such as file access, printing, or database access.

Aruna (DSCASC) 86

• In World wide web, many applications use three tier architecture. • There is an intermediate layer between the client and the database server

called the application server or web server and is named according to the application.

Three-Tier architecture

GUI, Web Interface

Application ProgramsWeb pages

Database ManagementSystem

Logical three-tier client/server architecture

Client

Application Server

(or) web server

Database server

Aruna (DSCASC) 87

• The web server plays the intermediary role by sorting business rules (procedures or constraints) that are used to access data from the database server.

• The intermediate server accepts request from the client, processes the request and sends database commands to the database server, and then pass the processed data from the database server to the client.

Three-Tier architecture

Classification of Database Management Systems

We classified DBMSs according to several criteria:

» Based on Data model» Based on Number of users » Based on Number of sites ( Distributed or Centralized)

» Based on Types of access paths » Cost of the DBMS

Aruna (DSCASC) 88

Aruna (DSCASC) 89

Based on Number of users:

1) Single-user system: It support only one user at a time and mostly used on personal computers.

2) Multi-user system: It Supports multiple users at a time (i.e., Concurrently).

Based on number of sites (Centralized or Distributed):

Centralized: If the data is stored at a single computer site, which can be used by multiple users..

Distributed: Database and DBMS software distributed over many sites, connected by a computer network. Homogeneous: It is the same DBMS existing in multiple sites.

– Based on the types of Access path.

– Cost of the DBMS.

Aruna (DSCASC) 90

Difference between Centralized and Distributed DBMS

Centralized DistributedIf the data is stored at a single computer site, which can be used by multiple users

Database and DBMS software distributed over many sites, connected by a computer network.

Database is maintained at one site Database is maintained at a number of different sites.

If centralized system fails, entire system is halted.

If one system fails, system continues work with other site.

Less reliable More reliable