Upload
ninh-ha
View
223
Download
0
Embed Size (px)
Citation preview
7/29/2019 gii thiu v csdl
1/21
Advanced Database Technology
Ho NGUYEN
College of Technology,
Vietnam National University, Hanoi
18 February 2013 [email protected]
Fundamental Notions of Database
7/29/2019 gii thiu v csdl
2/21
Advanced Database Technology Information Systems Department 2
Definitions
Information system: model about some phenomena in the
world - the Universe of Discourse - (e.g. an organization) retrieves, updates and deletes these facts
derives other facts from existing ones
Data - raw facts/details of the model
DATABASE: A shared collection of logically related data(and a description of this data), designed to meet theorganization needs of an organization
Database Management System (DBMS): software thatenables users to define, create and maintain the databaseand provides controlled access to the database
7/29/2019 gii thiu v csdl
3/21
Advanced Database Technology Information Systems Department 3
nh ngha
M hnh h thng thng tin v mt s hin tng trong th
gii v tr lun (v d nh mt t chc) truy xut, cp nht v xa cc s kin
ngun gc s kin khc t nhng ci hin
- Nguyn d liu s kin / chi tit ca m hnh
DATABASE: Mt b su tp c chia s d liu mt cchhp l c lin quan (v mt m t d liu ny), c thitk p ng cc t chc nhu cu ca mt t chc
H thng qun l c s d liu (DBMS): phn mm chophp ngi dng nh ngha, to ra v duy tr c s d liuv cung cp kim sot truy cp vo c s d liu
7/29/2019 gii thiu v csdl
4/21
Advanced Database Technology Information Systems Department 4
Functions of a DBMS
Data storage, retrieval, update
A user-accessible catalog
Transaction support
Concurrency control
Recovery services
Authorization services
Support for data communication
Integrity services
Data independence
Utility services
Lu tr d liu, phc hi,
cp nhtMt danh mc s dngtruy cph tr giao dch
kim sot ng thidch v phc hiy quyn dch vH tr truyn thng dliutnh ton vn dch vd liu c lpdch v tin c
7/29/2019 gii thiu v csdl
5/21
Advanced Database Technology Information Systems Department 5
Interacting with the DBMSTng tc vi cc DBMS
ApplicationProgramsEnd Users
Database
DBMS
7/29/2019 gii thiu v csdl
6/21
Advanced Database Technology Information Systems Department 6
Components of the DatabaseCc thnh phn ca c s d liu
DDLSTATEMENTS
PRIVILEGEDCOMMANDS
DBA Staff
DDLcompiler
Precompiler
DMLstatements
DMLcompiler
APPLICATIONPROGRAMS
applicationprogrammers
COMPILEDTRANSACTIONS
Host LanguageCompiler
casual users
HIGH-LEVELQUERY
QueryProcessor
Run time
DatabaseProcessor
SystemCatalog/
Data
Dictionary
Concurrency control/Backup/Recovery
Subsystems
STORED DATABASE
DatabaseManager
7/29/2019 gii thiu v csdl
7/21Advanced Database Technology Information Systems Department 7
Database Manager Components
Authorization control - check authorized to carry out
operation Command processor - control of operation
Integrity checker - updates checked against constraints
Query Optimizer - determine optimal strategy for query
Transaction Manager - controls transaction operations
Scheduler - ensure concurrent operations do not conflict
Recovery Manager - if failure returns to a consistent state
Buffer Manger - transfer of data between memory and CPU Recovery Manager and Buffer Manger often referred to
collectively as Data manager
7/29/2019 gii thiu v csdl
8/21Advanced Database Technology Information Systems Department 8
Qun l c s d liu thnh phn
Kim sot y quyn - t phng y quyn thc hin hot
ng Lnh x l - kim sot hot ng
Tnh ton vn kim tra - cp nht kim tra i vi cc rngbuc
truy vn ti u xc nh chin lc ti u cho truy vn Giao dch v qun l kim sot cc hot ng giao dch
ln lch m bo hot ng ng thi khng xung t
phc hi qun l - nu tht bi tr v mt nh nc thngnht
m manger- chuyn giao d liu gia b nh v CPU
phc hi qun l v b m mng c thng c gichung l qun l d liu
7/29/2019 gii thiu v csdl
9/21
7/29/2019 gii thiu v csdl
10/21Advanced Database Technology Information Systems Department 10
Maintaining the Database
This is the task of the DBA:
Maintaining information structure of the database (metadatain the Data Dictionary)
Define user requirements of data usage
Monitor use of database
Determine and optimize storage structure and access
strategies
Define authorization checks
Define strategies for backup and recovery
Define testing procedures and changeover policy
7/29/2019 gii thiu v csdl
11/21Advanced Database Technology Information Systems Department 11
Duy tr c s d liu
y l nhim v ca DBA:
Duy tr thng tin cu trc ca c s d liu (d liu metatrong t in d liu)
Xc nh yu cu ngi s dng s dng d liu
Mn hnh s dng c s d liu
Xc nh v ti u ha cu trc lu tr v chin lc truycp
Xc nh kim tra y quyn
Xc nh chin lc sao lu v phc hi
Xc nh th tc kim tra v chnh sch chuyn i
7/29/2019 gii thiu v csdl
12/21Advanced Database Technology Information Systems Department 12
Data Models and SchemasM hnh d liu v lc Data Model
Specifies the allowable logical structures and operations in adatabase. A DBMS operates always according to a specific data
model eg. relational
(M hnh d liu: Ch nh cc cu trc hp l cho php v hot ngtrong mt c s d liu. DBMS chia tay lun lun theo mt m hnh c
th v d nh d liu. quan h) Database Schema (intension)
The description of a database for a particular universe of discourse
which follows the rules layed down by the data model supported by
the target DBMS
(Lc c s d liu (tng thm):Cc m t ca mt c s d liuc th ca mt v tr lun theo cc quy tc layed xung bi m hnhd liu c h tr bi cc DBMS ch)
7/29/2019 gii thiu v csdl
13/21Advanced Database Technology Information Systems Department 13
01 BOOK02 TITLE PIC X(30)02 AUTHOR_NAME
PIC X(20)
01 BOOK02 TITLE PIC X(30)02 PUBLISH_NAME
PIC X(20)02 YEAR PIC 9(4)
VIEW 1 VIEW 2
BOOKTITLE CHARACTER(30
AUTHOR CHARACTER (20)PUBLISHER CHARACTER(20)YEAR NUMERIC (4)
BOOKSHOP
EXTERNAL LEVEL(individual view)
CONCEPTUAL LEVEL(community view)
INTERNAL LEVEL(storage view)
VIEW 1 VIEW 2
StructuralProperties
& Constraints
LogicalRepresentation
of Stored Records
STORED_BOOK LENGTH=80PREFIX TYPE=BYTE(6)TITLE TYPE=BYTE(30), INDEX=TITLE X
AUTHOR TYPE=BYTE(20)etc
3-levels Architecture3-cp kin trc
7/29/2019 gii thiu v csdl
14/21Advanced Database Technology Information Systems Department 14
Data Independence
Logical Data Independence: The capacity to change the
conceptual schema without having to change the externalschemas and their application programs .(Hp l d liu clp: kh nng thay i lc khi nim m khng cn
phi thay i cc lc bn ngoi v cc chng trnhng dng ca h)
Physical Data Independence: The capacity to change the
internal schema without having to change the conceptual
schema .(c lp d liu vt l: Kh nng thay i gin ni b m khng cn phi thay i cc lc khi nim.)
7/29/2019 gii thiu v csdl
15/21Advanced Database Technology Information Systems Department 15
Database Languages
External Level: mc ngoi
Generalized Query Language(DDL + DML)One or more Host Languages
e.g. COBOL, FORTRAN etc
Embedded Sublanguage(DDL + DML)
Application Programming
Specialized Query Language
e.g. forms-driven, graphics-driven, menu-driven etc
End-user Facilities
Data Definition Language (DDL)& Data Manipulation Language (DML)Ngn ng nh ngha d liu (DDL)
Ngn ng thao tc d liu (DML)
Data Definition Language (DDL)
Conceptual Level: Mc Khi nim
Internal Level: Mc trong
7/29/2019 gii thiu v csdl
16/21Advanced Database Technology Information Systems Department 16
System Catalog
A system catalog contains the description of the database
Often referred to as the 'data dictionary'
For the relational data model the catalog is defined and
interrogated using the same languages that can be used at
the application level (i.e. DDL and DML) - but includes extra
commands The catalog describes:
the basic make up of the data items
base data
views
authorization data
integrity constraints
7/29/2019 gii thiu v csdl
17/21Advanced Database Technology Information Systems Department 17
danh mc h thng
Mt danh mc h thng cha cc m t ca cc c s d
liu Thng c gi l 'd liu t in
i vi m hnh d liu quan h, danh mc c xc nhv thm vn bng cch s dng cng ngn ng c th
c s dng mc ng dng (tc l DDL v DML) -nhng bao gm cc lnh thm
Danh mc m t:
c bn ca cc mc d liu
c s d liu views
cho php d liu
tnh ton vn rng buc
7/29/2019 gii thiu v csdl
18/21Advanced Database Technology Information Systems Department 18
Views
A view represents virtual data structures which are derived
from base data structures (Xem Mt i din cho cu trcd liu o m c ngun gc t c s cu trc d liu)
Views permit users to perceive the database in terms of
derived data which correspond exactly to their applications
(Xem cho php ngi s dng cm nhn c s dliu v d liu c ngun gc t tng ng chnh xccho cc ng dng ca h)
Views insulate programmers from base data and enable
changes to definitions of base data without affecting
application programs (Xem cch nhit cc lp trnh vint c s d liu v cho php thay i nh ngha ca cs d liu m khng nh hng n cc chng trnhng dng)
7/29/2019 gii thiu v csdl
19/21Advanced Database Technology Information Systems Department 19
Example of a View
Title Author Publisher Year
Intro to DB Systems Date Addison-Wesley 1986
Fund. of DB Systems Elmasri Addison-Wesley 1989
London Fields Amis Penguin 1989
100 years of solitude Marquez Picador 1982
The history man Bradbury Arrow Books 1977
BOOK
CREATE VIEW NEW_BOOKAS SELECT TITLE, AUTHOR
FROM BOOKWHERE YEAR>1988
Title Author
Fund. of DB Systems Elmasri
London Fields Amis
NEW_BOOK
at run-time
7/29/2019 gii thiu v csdl
20/21Advanced Database Technology Information Systems Department 20
History
The first DBMS was designed by Bachman at GE in early
1960sBachman (Turing award 1973).
In 1970 Codd at IBM proposed a new data representationframework called the relational data model.
Codd (Turing Award 1981)
The SQL query for relational databases, developed as part ofIBM's System R project, was standardized in the late 1980s.
SQL-92, was adopted by ANSI (American NationalStandards Institute) and ISO (International Standards
Organization). SQL-1999 added packages for data mining, spatial data, and
text documents SQL2003 : XML, Window functions, and sequences (Not free)
7/29/2019 gii thiu v csdl
21/21
History
In late 1980s and 1990s, several vendors (e.g. IBM's
DB2, Oracle 8, Informix UDS) have extended theirsystems with the ability to store new data types such as
images and text.
Specialized systems developed fordata warehouses,
consolidating data from several databases.
Entering the Internet Age, a new markup language
XML is proposed for data access through a Web
browser.
As more and more data are collected, companies are
also interested to mine useful information from their
data.