Download Database system concept and Architecture

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft SQL Server wikipedia , lookup

IMDb wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Oracle Database wikipedia , lookup

Concurrency control wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Relational model wikipedia , lookup

Database wikipedia , lookup

ContactPoint wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Database system
concept and
Architecture

Data Models, Schemas, and Instance
– Categories of Data Models
– Schemas, Instance, and Database State

Three-schema Architecture and Data Independence
– The three levels of the Architecture
– Data Independence

Database languages and Interface
– DBMS Language
– DBMS Interfaces

The Database System Environment
– DBMS component Modules
– Database system Utilities

Centralize and Client/Server Architectures for DBMSs
– Basic Client/Server
– Two-tier Client/Server Architecture for DBMSs
– Three-tier Client/Server Architectures for Web Applications


Classification of Database Management Systems
Summary
Data Models, Schemas, and
Instance


Data Model: a collection of concepts that
can be use to describes the structure of a
database – provides the necessary means
to achieve this abstractions.
Structure of Database mean the data
types, relationships, and constraints that
should hold for the data.
Categories of Data Models
Categorize by the type of concepts they
use to describe the database structure



High level or Conceptual Data
Model
Low-level or Physical Data Model
Representational or
Implementation Data Model
Low Level Data Model

provide concepts that describe
the details of how data is stored
in the computer. Usually
provided for specialists, not for
typical end users.
High Level or Conceptual Data
Model


provide concepts that are closed to
the way many users perceive data.
Example: use concepts such as entities,
attributes, and relationships among two or
more entities.
Fcode
Dcode
F_name
N
1
Faculty
Department
Compose of
1
N
Student
D_code
D_name
D_name
Representation or Implementation
Data Models

provide concepts that may be
understood by end users but they are
not too far removed from the way data
is organized with in the computer. This
hide some details of data storage but
can be implemented on a computer
system in a direct way.
Faculty
Fcode
Department
F_name
Fcode
Dcode
D_name
Student
SID
S_name S_Add
Fcode
Dcode
Schemas, Instances, and
Database State

Database Schema
– is the description of a data base
– specified during database design
– and is not expect to change frequency

Schema Diagram
– A displayed schema example the diagram displays the structure
of each record type but not the instance records.
– It displays only some aspect schema, for example name of
record types and data items and some type of constraints

Database state or snapshot
– is the data in the database at a particular moment in time.
– Also called the current set of occurrences or instances in the
database

Distinction between database schema
and database state
– When define a new database => specify
only database schema to DBMS
– At this point “database state is empty
state” no data.
– Get initial state => loaded with initial
data
– At any point in time, the database has a
current state (current snapshot)
– DBMS stores the descriptions of the
schema constructs and constraints (called
meta-data) in DBMS Catalog
The three levels of the
Architecture

The ANSI/SPARE
architecture is
divided into 3
levels
Internal Level
External Level
Conceptual Level
External level
(Individual user
Views)
Conceptual level
(community user
View)
Internal level
(Storage View)
……..
External View


External level is individual user lever.
Each user has a language
– For application programmer, the language will be
either


conventional programming language (e.g. Java, C++)
Fourth-generation language
– For the end user, the language will be either


a query language (SQL)
Special purpose language perhaps forms, or menu
driven, tailored to that user’s requirements and
supported by some application
Conceptual Level

Conceptual view is a representation of the entire
information content of the database.

The conceptual view consists of many types of conceptual
record.




The conceptual view is defined by means of the
conceptual schema, which includes definitions of each
of the various conceptual record types.
The conceptual schema is written using another data
definition language, the conceptual DDL.
The conceptual DDL definitions must not involve any
considerations of physical representation or access
techniques at all.
They must be no reference in the conceptual schema to
stored field representation, stored record sequence, indexes,
hashing schemas, pointer, or any storage and access details.
Internal Level




Internal View is a low-level representation of the
entire database; it consist of many occurrences of
many types of internal record.
Internal record is the ANSI/SPARE term for the
construct that we have been calling a stored
record.
The internal view is described by means of the
internal schema, which not only defines the
various stored record types but also
specifics what indexes exist, how stored
fields are represented, what physical sequence
the stored record are in, and so on.
The internal schema is written using yet another
data definition language – the internal DDL.
Example
External 1
DCL
External 1
1 EMPP,
2 EMP# CHAR(6)
2 SAL FIXED BN(31);
01 EMPC.
02 EMPNO PIC X(6).
02 DEPTNO PIC X(4).
Conceptual
Employee
Employee_number
Department_Number
Salary
Char(6)
Char(4)
Decimal(5)
Internal
Stored_Emp
PREFIX
EMP#
DEPT#
PAY#
Bytes=20
BYTES=6,OFFSET=0
BYTES=6,OFFSET=6, INDEX=EMPX
BYTES=4,OFFSET=12,
BYTES=4,ALIGN=FULLWORD,OFFSET=16
User A1
User A2
User B1
User B2
User B3
Host
Language
+DSL
Host
Language
+DSL
Host
Language
+DSL
Host
Language
+DSL
Host
Language
+DSL
*External
Schema
A
External/conceptual
Mapping A
Schemas
And
mappings
built and
maintained
by
the database
administrator
(DBA)
External View B
Conceptual/Internal
Mapping B
Conceptual View
Database
Management
System
(DBMS)
Conceptual/Internal
mapping
Storage
Structure
Definition
(internal
Schema)
*User interface
External View A
*External
Schema
B
Stored Database (Internal View)
Mappings

Conceptual/Internal mappings
– defines the correspondence between the
conceptual view and the stored database;
– It specified how conceptual records and fields
are represented at the internal level.
– If the stored database is changes


If the change has effect to the stored database
definition – then the conceptual/Internal mapping
must be changes accordingly
The effects of changes must be isolated below the
conceptual level, in order to preserve physical
data independence.

External/Conceptual mapping
– Defines the correspondence between a
particular external view and the conceptual
view.
– Example field and record name change
Data Independence


Defines as the capacity to change the
schema at one level of a database system
without having to change the schema at
the next higher level.
Define 2 types of data independence.
Logical Data independence
Physical Data independence
Logical Data independence

Logical Data independence is the
capacity to change the conceptual schema
without have to change external schemas
or application program.
– Example
Expand the database by adding record type or
data item.
 To change the constraints
 To reduce the database by removing a record type

– The external schemas that refer only to the
database should not be affected.
Example
Faculty
Fcode
Department
F_name
Fcode
Dcode
D_name
Student
SID
S_name S_Add
Fcode
Dcode
T_name S_Add
Fcode
Dcode
Teacher
Tcode
Tcode
Example 2
Faculty
Fcode
Department
F_name
Fcode
Dcode
D_name
Student
SID
S_name S_Add
Fcode
Dcode
T_name S_Add
Fcode
Dcode
Tcode
Teacher
Teach
Tcode
Create view teacher1
as select sid ,sname, T_name
from student, teach
where student.tcode = teach.tcode
Select sid, sname, T_name
from teacher1
Create view teacher1
as select sid ,sname, T_name
from student, teacher
where student.tcode = teacher.tcode
Physical Data independence

Physical Data independence is the
capacity to change the conceptual
schema, the external schemas need not
be changed.
– Change may be needed because some
physical files had to be reorganized
– Example

Creating additional access structures to improve
the performance of retrieval or update
Database language and
interface

DBMS language
– Data definition language (DDL) is used by
DBA and database designer to define
schemas.
– Storage Definition Language (SDL) is
used to specify internal schema
– Data Manipulation Language (DML) is a
set of operation for retrieval insertion
deletion and modifies the data.
DBMS Interfaces






Menu Based Interfaces for web Clients
or Browsing.
Form Based Interfaces
Graphical User Interfaces
Natural Languages Interfaces
Interface of Parametric Users
Interfaces for the DBA
The Database System
Environment

DBMS Component Modules
Component modules of a DBMS and their interactions
Application Programmers
DBA staff
APPLICATION
PROGRAMS
Casual
users
DDL
STATEMENTS
PRIVILEGED
COMMANDS
Parametric
users
Precompiled
INTERACTIVE
Query
Host Language
Compiler
A
DDL
Complier
E
System
Catalog/
Data
Dictionary
execution
Stored Data
Manager
DML
STATEMENTS
Query
Complier
B
COMPILES
Transaction
DML
Complier
C
Run-time
Database
Processor
D
execution
Concurrency control/
Backup/Recovery subsystem
Stored Database
Data Dictionary





The DBMS must provide a data dictionary function.
The data dictionary is a system database (not user
database)
It contains “data about the data” called “meta-data
or descriptor” – that is, definitions of those objects
in the system, instead of just “raw data”.
It will keep all of various schemas and mapping and
all of the various security and integrity constraints,
both source and object form.
Other terms are “dictionary”, “catalog”, “data
repository”.
Database System Utilities
Database Utility helps the DBA in
managing the Database system
Loading : to create the initial version of the database
from regular data file
Backup/Restore
File reorganization
Performance Monitoring
Centralized and Client/Server
Architecture for DBMSs

Centralized DBMSs Architecture
– Centralized DBMS => all DBMS function
– All processing was performed remotely on
the computer system, only display
information and controls were sent from
the computer to display terminal
Basic Client/Server




Idea is to define specialized servers with specific
functionalities.
Client machines provide the user with the
appropriate interfaces to utilize the server, and local
processing power to run local application.
Client is a user machine that provide user
interface capabilities and local processing. When
requires process not in that machine it connects to
a server that provide the needed functions.
Server is a machine that can provide service to
the client machine.
Two main type of basic DBMS
architectures on client/server
frame work


Two-tier Client/Server
Architecture
Three-tier Client/Server
Architecture
Two-tier Client/Server
……
Client
site1
Client
Site2
Server
Site3
Communication Network
Server
Client
Site n
Three-tier Client/Server
Architecture
Client
GUI
Web Interface
Application Server
Or
Web server
Application
Program
Web Pages
Database
Server
Database
Management
System
Client contain GUI interface
and some additional business
rule
This server plays an
intermediate role by
storing business rule
(procedure/constraints)
that are used to access
data from the database
server. Also improve
database security.
Classification of DBMS

By Data Model
– Relational Data Model
– Object Data Model
– Hierarchical and Network Data Models

By numbers of users supported by the system
– Single User system
– Multi User system

Number of Sites
– Centralized => the data stored at a single computer site
– Distributed DBMS (DDBMS) => have the actual database and
DBMS software distributed over many sites



Homogenous DDBMSs
Heterogeneous DBMSs
Purpose
– General Purpose
– Special Purpose
Summary


Introduces the main concepts used in database systems
Define Data model & distinguished three main categories of
data models:
– High-level/Conceptual
– Low Level
– Representation/Implementation


Schema -> description of a database
Describe the three-schema DBMS architecture
– Internal, Conceptual and External

Main types of languages and interfaces that DBMSs support
– DDL - define Database conceptual schema
– DSL – specifying views and storage structures
– DML – retrieval, update

Classified DBMS
Figure illustrates a typical variation of Oracle's memory and
process structures








Memory Structures and Processes
The mechanisms of ORACLE execute by using memory structures and
processes. All memory structures exist in the main memory of the
computers that constitute the database system. Processes are jobs or tasks
that work in the memory of these computers.
Memory Structures
ORACLE creates and uses memory structures to complete several jobs. For
example, memory is used to store program code being executed and data
that is shared among users. Several basic memory structures are associated
with ORACLE: the system global area (which includes the database and
redo log buffers, and the shared pool) and the program global area.
System Global Area (SGA) is a shared memory region allocated by
ORACLE that contains data and control information for one ORACLE
instance.
An ORACLE instance contains the SGA and the background processes.
The SGA is allocated when an instance starts and deallocated when the
instance shuts down. Each instance that is started has its own SGA.
The Program Global Area (PGA) is a memory buffer that contains data
and control information for a server process. A PGA is created by ORACLE
when a server process is started. The information in a PGA depends on the
configuration of ORACLE.
Database Structures
The relational model has three major aspects:
 Structures
– Structures are well-defined objects that store the data of a
database. Structures and the data contained within them can be
manipulated by operations.

Operations
– Operations are clearly defined actions that allow users to
manipulate the data and structures of a database. The
operations on a database must adhere to a pre-defined set of
integrity rules.

Integrity Rule
– Integrity rules are the laws that govern which operations are
allowed on the data and structures of a database. Integrity rules
protect the data and the structures of a database.
An ORACLE database has both a physical and a logical structure. By
separating physical and logical database structure, the physical storage of
data can be managed without affecting the access to logical storage
structures.
Logical Database Structure
 An ORACLE database's logical structure is determined by: one or more
tablespaces.


the database's schema objects (e.g., tables, views, indexes, clusters,
sequences, stored procedures).
The logical storage structures, including tablespaces, segments, and
extents, dictate how the physical space of a database is used. The
schema objects and the relationships among them form the relational
design of a database.
Tablespaces and Data Files Tablespaces are the primary logical storage structures of
any ORACLE database. The usable data of an ORACLE database is logically stored in
the tablespaces and physically stored in the data files associated with the
corresponding tablespace. Figure 2 illustrates this relationship.

Although databases, tablespaces, data files, and segments are closely related, they
have important differences:

databases and tablespaces
–

tablespaces and data files
–

Each tablespace in an ORACLE database is comprised of one or more operating system files
called data files. A tablespace's data files physically store the associated database data on
disk.
databases and data files
–

An ORACLE database is comprised of one or more logical storage units called tablespaces.
The database's data is collectively stored in the database's tablespaces.
A database's data is collectively stored in the data files that constitute each tablespace of
the database. For example, the simplest ORACLE database would have one tablespace, with
one data file. A more complicated database might have three tablespaces, each comprised
of two data files (for a total of six data files).
schema objects, segments, and tablespaces
–
When a schema object such as a table or index is created, its segment is created within a
designated tablespace in the database. For example, suppose a table is created in a specific
tablespace using the CREATE TABLE command with the TABLESPACE option. The space for
this table's data segment is allocated in one or more of the data files that constitute the
specified tablespace. An object's segment allocates space in only one tablespace of a
database.