database environment

Download Report

Transcript database environment

DATABASE ENVIRONMENT
Dream World Case Study
• Real World entities Staff, property, Owner and
Renters
• Attributes describing properties or qualities of
each entity
• Relationships between these entities (Staff
MANAGES Property)
ANSI-SPARC three-level
architecture
View 1
View 2
Conceptual
schema
Internal schema
Database
American National Standard Institute (ANSI)Standards Planning and Requirements Committee (SPARC)
View n
External
Level
Conceptual
Level
Internal
Level
• EXTERNAL LEVEL
– User’s view of the database
– Part of the database that is relevant to a user
• CONCEPTUAL LEVEL
– Community view of the database
– What data is stored in the database
– Relationships among the data
– Entities, their attributes and relationships
– Security and integrity information
INTERNAL LEVEL
Physical representation of the database on the
computer
• Internal level
–
–
–
–
Storage space allocation of data and indexes
Record description for storage
Record placement (pointers)
Data compression and encryption techniques
Differences between the three levels
External View 1
External View 2
Sno Staff_No Fname Lname Age Salary
Conceptual
level
Staff_No Lname Branch_No
Staff_No Fname Lname DOB Salary Branch_No
Struct STAFF {
int Staff_No;
int Branch_No;
Internal level
char Fname[15];
char Lname[15];
struct date Date_of_Birth;
float salary;
struct STAFF *next;
//pointer to next staff record
};
index Staff_No; index Branch_No;
// define indexes for staff
DATA INDEPENDENCE
• Logical Data Independence: Possibility for
addition/removal of new entities, attributes
or relationships
• Physical Data Independence: Possibility for
changes to storage structures
Data Independence
External
schema
External/ conceptual
mapping
External
schema
External
schema
Logical data independence
Conceptual
schema
Conceptual/ Internal
mapping
Physical data independence
Internal
schema
Database Languages
• Data definition Language (DDL):
– A descriptive language
– Name the entities and relationships
• Data Manipulation Language (DML):
– Data Manipulation Operations:
–
–
–
–
Insertion of new data
Modification of data
Retrieval of data
Deletion of data
DMLTypes
• Procedural DML:
– What data is needed
– How to retrieve this? (record by record)
• Non-Procedural DML:
– What data is needed rather than how to retrieve
it. (based on set of records)
4GL
• Query languages, Form generators, Report generators.
• Specialty languages such as spreadsheets and database
languages
• Application generators (define, insert, update and
retrieve data)
• Program Generators
• Graphics generators
Data Model
• An integrated collection of concepts
– For describing data
– Relationships
– Constraints
• Object Based Data Models
– Entity
– Attributes
– Behavior
• Record Based Data Model
– Relational, Network, Hierarchical,
Multidimensional
Network Data Model
Relational Data Model
Multidimensional Data Model
Object Oriented Data Model
Functions of a DBMS
• 1) Data storage, retrieval and update
• 2) A user accessible catalog
– System Catalog stores :
•
•
•
•
•
•
Names, sizes and types of data items
Names of relationships
Integrity constraints
Names of authorized users who have access
External, conceptual and internal schemas
Usage statistics
(Functions contd…)
• 2) A user accessible catalog (contd.)
– Benefits of a System catalog:
•
•
•
•
Collection and storage at one place
Meaning of the data can be referred
Communication is simplified
Redundancy and inconsistencies can be identified
more easily
• Changes to the database can be recorded
• Security
• Integrity
• 3) Transaction Support
• 4) Concurrency control services
The Lost Update Problem
Time
T1
t1
T2
balx
read (balx)
100
t2
real (balx)
balx = balx +100
100
t3
balx=balx-10
write (balx )
200
t4
write (balx )
t5
90
90
•
•
•
•
•
•
(Functions contd…)
5) Recovery services
6) Authorization services
7) Support for data communication
8) Integrity services
9) Service to promote data independence.
10) Utility services
Components of a DBMS
Programmers
Application
Programs
DBMS
Users
Queries
DBA
Database
schema
DML
Preprocessor
Query
Processor
DDL
Compiler
Program
object code
Database
Manager
Dictionary
Manager
Access
methods
System
buffers
File
Manager
Database and
system catalog
Components of a database manager
Program Object
Code
Database manager
Integrity
Checker
Data manager
Access
Methods
System buffers
Query
processor
Catalog
Manager
Authorization
Control
Command
processor
Query
Optimizer
Transaction
Manager
Scheduler
Buffer
Manager
Recovery
Manager
File
Manager
Databases and
system catalogs
Teleprocessing Topology
File Server architecture
Workstation 2
Workstation 1
Workstation 3
A Large amount of network
traffic
A full copy of DBMS is
required on each workstation
LAN
Concurrency, recovery and
integrity control are more
complex
Request for data
database
File Server
Client Server architecture
Client 2
Client 1
Client 3
LAN
Request for data
Server (with
DBMS)
Selected data returned
database
Alternate client-server topologies
client
Server
Single Client Single Server
Server
Multiple Client
- Single Server
Client 1
Client 2
Client 1
Multiple Client Server 1 Multiple Server
Client 2
Client 3
Server 2
Summary of Client server applications
Client
• Manages the user
interface
• Accepts and check
syntax of user input
• Process application
• Generates database
requests and transmits
to the server
• Passes response back
to user
Server
• Accepts and processes database
requests from clients
• Checks authorization
• Ensures integrity constraints not
violated
• Performs query/ update
processing and transmits
response to client
• Maintains system catalog
• provides concurrent database
access
• Provides recovery control