database concepts and architecture

Upload: cl-dv

Post on 17-Feb-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/23/2019 Database Concepts and Architecture

    1/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 1

  • 7/23/2019 Database Concepts and Architecture

    2/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe

    Chapter 2Dataase System Con!epts and

    "r!hite!t#re

  • 7/23/2019 Database Concepts and Architecture

    3/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 3

    $#tline

    Data %odels and &heir Categories 'istory o( Data %odels S!hemas) *nstan!es) and States &hree+S!hema "r!hite!t#re Data *ndependen!e DB%S ,ang#ages and *nter(a!es

    Dataase System -tilities and &ools Centralized and Client+Server "r!hite!t#res Classi(i!ation o( DB%Ss

  • 7/23/2019 Database Concepts and Architecture

    4/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 4

    Data %odels

    Data Model: " set o( !on!epts to des!rie the structureo( a dataase)

    the operations (or manip#lating these str#!t#res) and

    !ertain constraintsthat the dataase sho#ld oey.

    Data Model Structure and Constraints: Constr#!ts are #sed to de(ine the dataase str#!t#re

    Constr#!ts typi!ally in!l#de elements and their data

    types/ as ell as gro#ps o( elements e.g. entity, record,

    table/) and relationshipsamong s#!h gro#ps Constraints spe!i(y some restri!tions on valid data1 these

    !onstraints m#st e en(or!ed at all times

  • 7/23/2019 Database Concepts and Architecture

    5/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 5

    Data %odels !ontin#ed/

    Data Model Operations: &hese operations are #sed (or spe!i(ying dataase

    retrievalsand updatesy re(erring to the

    !onstr#!ts o( the data model. $perations on the data model may in!l#de basic

    model operations e.g. generi! insert) delete)

    #pdate/ anduser-defined operations e.g.

    !omp#test#dentgpa) #pdateinventory/

  • 7/23/2019 Database Concepts and Architecture

    6/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 6

    Categories o( Data %odels

    Conceptual (high-level se!antic" data !odels: 3rovide !on!epts that are !lose to the ay many #sers

    per!eive data. "lso !alled entity-basedorobject-baseddata models./

    #h$sical (lo%-level internal" data !odels: 3rovide !on!epts that des!rie details o( ho data is stored

    in the !omp#ter. &hese are #s#ally spe!i(ied in an ad+ho!manner thro#gh DB%S design and administration man#als

    &!ple!entation (representational" data !odels: 3rovide !on!epts that (all eteen the aove to) #sed y

    many !ommer!ial DB%S implementations e.g. relationaldata models #sed in many !ommer!ial systems/.

  • 7/23/2019 Database Concepts and Architecture

    7/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- '

    S!hemas vers#s *nstan!es

    Dataase S!hema4 &he descriptiono( a dataase. *n!l#des des!riptions o( the dataase str#!t#re)

    data types) and the !onstraints on the dataase. S!hema Diagram4

    "n illustrativedisplay o( most aspe!ts o(/ adataase s!hema.

    S!hema Constr#!t4 " componento( the s!hema or an o5e!t ithin

    the s!hema) e.g.) S&-DEN&) C$-RSE.

  • 7/23/2019 Database Concepts and Architecture

    8/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2-

    S!hemas vers#s *nstan!es

    Dataase State4 &he a!t#al data stored in a dataase at a

    particular moment in time. &his in!l#des the

    !olle!tion o( all the data in the dataase. "lso !alled dataase instan!e or o!!#rren!e or

    snapshot/. &he term instance is also applied to individ#al

    dataase !omponents) e.g. record instance, tableinstance, entity instance

  • 7/23/2019 Database Concepts and Architecture

    9/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- )

    Dataase S!hema

    vs. Dataase State

    Dataase State4 Re(ers to the contento( a dataase at a moment

    in time.

    *nitial Dataase State4 Re(ers to the dataase state hen it is initially

    loaded into the system.

    6alid State4 " state that satis(ies the str#!t#re and !onstraints

    o( the dataase.

  • 7/23/2019 Database Concepts and Architecture

    10/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 1*

    Dataase S!hema

    vs. Dataase State !ontin#ed/

    Distin!tion &he database schema!hanges very in(re#ently.

    &he database state!hanges every time the

    dataase is #pdated.

    Sche!ais also !alled intension.

    Stateis also !alled e+tension.

  • 7/23/2019 Database Concepts and Architecture

    11/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 11

    E8ample o( a Dataase S!hema

  • 7/23/2019 Database Concepts and Architecture

    12/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 12

    E8ample o( a dataase state

  • 7/23/2019 Database Concepts and Architecture

    13/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 13

    &hree+S!hema "r!hite!t#re

    3roposed to s#pport DB%S !hara!teristi!s o(4 #rogra!-data independence,

    S#pport o( !ultiple vie%so( the data.

    Not e8pli!itly #sed in !ommer!ial DB%S prod#!ts)#t has een #se(#l in e8plaining dataase

    system organization

  • 7/23/2019 Database Concepts and Architecture

    14/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 14

    &hree+S!hema "r!hite!t#re

    De(ines DB%S s!hemas at threelevels4 &nternal sche!aat the internal level to des!rie physi!al

    storage str#!t#res and a!!ess paths e.g inde8es/. &ypi!ally #ses a ph$sicaldata model.

    Conceptual sche!aat the !on!ept#al level to des!rie the

    str#!t#re and !onstraints (or the hole dataase (or a

    !omm#nity o( #sers. -ses a conceptualor an i!ple!entationdata model.

    +ternal sche!asat the e8ternal level to des!rie thevario#s #ser vies. -s#ally #ses the same data model as the !on!ept#al s!hema.

  • 7/23/2019 Database Concepts and Architecture

    15/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 15

    &he three+s!hema ar!hite!t#re

  • 7/23/2019 Database Concepts and Architecture

    16/53

  • 7/23/2019 Database Concepts and Architecture

    17/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 1'

    Data *ndependen!e

    .ogical Data &ndependence: &he !apa!ity to !hange the !on!ept#al s!hema

    itho#t having to !hange the e8ternal s!hemasand their asso!iated appli!ation programs.

    #h$sical Data &ndependence: &he !apa!ity to !hange the internal s!hema

    itho#t having to !hange the !on!ept#al s!hema.

  • 7/23/2019 Database Concepts and Architecture

    18/53

  • 7/23/2019 Database Concepts and Architecture

    19/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 1)

    DB%S ,ang#ages

    Data De(inition ,ang#age DD,/

    Data %anip#lation ,ang#age D%,/ 'igh+,evel or Non+pro!ed#ral ,ang#ages4 &hese

    in!l#de the relational lang#age S:, %ay e #sed in a standalone ay or may e

    emedded in a programming lang#age

    ,o ,evel or 3ro!ed#ral ,ang#ages4 &hese m#st e emedded in a programming

    lang#age

  • 7/23/2019 Database Concepts and Architecture

    20/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 2*

    DB%S ,ang#ages

    Data De/inition .anguage (DD.": -sed y the DB" and dataase designers to

    spe!i(y the !on!ept#al s!hema o( a dataase.

    *n many DB%Ss) the DD, is also #sed to de(ineinternal and e8ternal s!hemas vies/. *n some DB%Ss) separate storage de/inition

    language (SD." andvie% de/inition language(0D."are #sed to de(ine internal and e8ternals!hemas. SD, is typi!ally realized via DB%S !ommands

    provided to the DB" and dataase designers

  • 7/23/2019 Database Concepts and Architecture

    21/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 21

    DB%S ,ang#ages

    Data Manipulation .anguage (DM.": -sed to spe!i(y dataase retrievals and #pdates

    D%, !ommands data s#lang#age/ !an e

    embeddedin a general+p#rpose programminglang#age host lang#age/) s#!h as C$B$,) C) C=

    =) or >ava. " lirary o( (#n!tions !an also e provided to a!!ess

    the DB%S (rom a programming lang#age "lternatively) stand+alone D%, !ommands !an e

    applied dire!tly !alled a query language/.

  • 7/23/2019 Database Concepts and Architecture

    22/53Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 22

    &ypes o( D%,

    igh .evel or on-procedural .anguage:

  • 7/23/2019 Database Concepts and Architecture

    23/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 23

    DB%S *nter(a!es

    Stand+alone #ery lang#age inter(a!es E8ample4 Entering S:, #eries at the DB%S

    intera!tive S:, inter(a!e e.g. S:,A3l#s in

    $R"C,E/ 3rogrammer inter(a!es (or emedding D%, in

    programming lang#ages

    -ser+(riendly inter(a!es %en#+ased) (orms+ased) graphi!s+ased) et!.

  • 7/23/2019 Database Concepts and Architecture

    24/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 24

    DB%S 3rogramming ,ang#age *nter(a!es

    3rogrammer inter(a!es (or emedding D%, in a

    programming lang#ages4 !edded pproach4 e.g emedded S:, (or C)

    C==) et!./) S:,> (or >ava/ #rocedure Call pproach4 e.g. >DBC (or >ava)

    $DBC (or other programming lang#ages

    Dataase #rogra!!ing .anguage pproach4

    e.g. $R"C,E has 3,S:,) a programminglang#age ased on S:,1 lang#age in!orporates

    S:, and its data types as integral !omponents

  • 7/23/2019 Database Concepts and Architecture

    25/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 25

    -ser+

  • 7/23/2019 Database Concepts and Architecture

    26/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 26

    $ther DB%S *nter(a!es

    Spee!h as *np#t and $#tp#t

    ;e Broser as an inter(a!e

    3arametri! inter(a!es) e.g.) ank tellers #sing

    (#n!tion keys. *nter(a!es (or the DB"4

    Creating #ser a!!o#nts) granting a#thorizations

    Setting system parameters

    Changing s!hemas or a!!ess paths

  • 7/23/2019 Database Concepts and Architecture

    27/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 2'

    Dataase System -tilities

    &o per(orm !ertain (#n!tions s#!h as4 ,oading data stored in (iles into a dataase.

    *n!l#des data !onversion tools.

    Ba!king #p the dataase periodi!ally on tape. Reorganizing dataase (ile str#!t#res.

    Report generation #tilities.

    3er(orman!e monitoring #tilities. $ther (#n!tions) s#!h as sorting) #ser monitoring)

    data !ompression) et!.

  • 7/23/2019 Database Concepts and Architecture

    28/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 2

    $ther &ools

    Data di!tionary repository4 -sed to store s!hema des!riptions and other

    in(ormation s#!h as design de!isions) appli!ation

    program des!riptions) #ser in(ormation) #sagestandards) et!.

    ctive data dictionar$is a!!essed y DB%S

    so(tare and #sersDB".

    #assive data dictionar$is a!!essed y#sersDB" only.

  • 7/23/2019 Database Concepts and Architecture

    29/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 2)

    $ther &ools

    "ppli!ation Development Environments and

    C"SE !omp#ter+aided so(tare engineering/

    tools4

    E8amples4 3oerB#ilder Syase/

    >B#ilder Borland/

    >Developer 0 $ra!le/

  • 7/23/2019 Database Concepts and Architecture

    30/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 3*

    &ypi!al DB%S Component %od#les

  • 7/23/2019 Database Concepts and Architecture

    31/53

  • 7/23/2019 Database Concepts and Architecture

    32/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 32

    " 3hysi!al Centralized "r!hite!t#re

  • 7/23/2019 Database Concepts and Architecture

    33/53

  • 7/23/2019 Database Concepts and Architecture

    34/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 34

    ,ogi!al to+tier !lient server ar!hite!t#re

  • 7/23/2019 Database Concepts and Architecture

    35/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 35

    Clients

    3rovide appropriate inter(a!es thro#gh a !lient

    so(tare mod#le to a!!ess and #tilize the vario#s

    server reso#r!es.

    Clients may e diskless ma!hines or 3Cs or;orkstations ith disks ith only the !lient

    so(tare installed.

    Conne!ted to the servers via some (orm o( a

    netork. ,"N4 lo!al area netork) ireless netork) et!./

  • 7/23/2019 Database Concepts and Architecture

    36/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 36

    DB%S Server

    3rovides dataase #ery and transa!tion servi!es to the!lients

    Relational DB%S servers are o(ten !alled S:, servers)#ery servers) or transa!tion servers

    "ppli!ations r#nning on !lients #tilize an "ppli!ation3rogram *nter(a!e #&/ to a!!ess server dataases viastandard inter(a!e s#!h as4 $DBC4 $pen Dataase Conne!tivity standard

    >DBC4 (or >ava programming a!!ess Client and server m#st install appropriate !lient mod#le

    and server mod#le so(tare (or $DBC or >DBC See Chapter G

  • 7/23/2019 Database Concepts and Architecture

    37/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 3'

    &o &ier Client+Server "r!hite!t#re

    " !lient program may !onne!t to several DB%Ss)

    sometimes !alled the data so#r!es.

    *n general) data so#r!es !an e (iles or other

    non+DB%S so(tare that manages data. $ther variations o( !lients are possile4 e.g.) in

    some o5e!t DB%Ss) more (#n!tionality is

    trans(erred to !lients in!l#ding data di!tionary

    (#n!tions) optimization and re!overy a!ross

    m#ltiple servers) et!.

  • 7/23/2019 Database Concepts and Architecture

    38/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 3

    &hree &ier Client+Server "r!hite!t#re

    Common (or ;e appli!ations

    *ntermediate ,ayer !alled "ppli!ation Server or ;e

    Server4 Stores the e !onne!tivity so(tare and the #siness logi!

    part o( the appli!ation #sed to a!!ess the !orresponding

    data (rom the dataase server

    "!ts like a !ond#it (or sending partially pro!essed data

    eteen the dataase server and the !lient.

    &hree+tier "r!hite!t#re Can Enhan!e Se!#rity4 Dataase server only a!!essile via middle tier

    Clients !annot dire!tly a!!ess dataase server

  • 7/23/2019 Database Concepts and Architecture

    39/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 3)

    &hree+tier !lient+server ar!hite!t#re

  • 7/23/2019 Database Concepts and Architecture

    40/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 4*

    Classi(i!ation o( DB%Ss

    Based on the data model #sed &raditional4 Relational) Netork) 'ierar!hi!al. Emerging4 $5e!t+oriented) $5e!t+relational.

    $ther !lassi(i!ations Single+#ser typi!ally #sed ith personal

    !omp#ters/vs. m#lti+#ser most DB%Ss/.

    Centralized #ses a single !omp#ter ith onedataase/vs. distri#ted #ses m#ltiple !omp#ters) m#ltipledataases/

  • 7/23/2019 Database Concepts and Architecture

    41/53

  • 7/23/2019 Database Concepts and Architecture

    42/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 42

    Cost !onsiderations (or DB%Ss

    Cost Range4 (rom (ree open+so#r!e systems to!on(ig#rations !osting millions o( dollars

    E8amples o( (ree relational DB%Ss4 %yS:,) 3ostgreS:,)others

    Commer!ial DB%S o((er additional spe!ialized mod#les)e.g. time+series mod#le) spatial data mod#le) do!#mentmod#le) H%, mod#le &hese o((er additional spe!ialized (#n!tionality hen

    p#r!hased separately Sometimes !alled !artridges e.g.) in $ra!le/ or lades

    Di((erent li!ensing options4 site li!ense) ma8im#m n#mero( !on!#rrent #sers seat li!ense/) single #ser) et!.

  • 7/23/2019 Database Concepts and Architecture

    43/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 43

    'istory o( Data %odels

    Netork %odel

    'ierar!hi!al %odel

    Relational %odel

    $5e!t+oriented Data %odels

    $5e!t+Relational %odels

  • 7/23/2019 Database Concepts and Architecture

    44/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 44

    'istory o( Data %odels

    et%or Model: &he (irst netork DB%S as implemented y

    'oneyell in GIJ+IK *DS System/.

    "dopted heavily d#e to the s#pport y C$D"SL,Con(eren!e on Data Systems ,ang#ages/C$D"SL, + DB& report o( G7/.

    ,ater implemented in a large variety o( systems +*D%S C#llinet + no Comp#ter "sso!iates/) D%S00 -nisys/) *%"E '.3. 'elett+3a!kard//)6"H +DB%S Digital E#ipment Corp.) ne8tC$%3":) no '.3./.

  • 7/23/2019 Database Concepts and Architecture

    45/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 45

    E8ample o( Netork %odel S!hema

  • 7/23/2019 Database Concepts and Architecture

    46/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 46

    Netork %odel

    "dvantages4 Netork %odel is ale to model !omple8

    relationships and represents semanti!s o(adddelete on the relationships.

    Can handle most sit#ations (or modeling #singre!ord types and relationship types.

    ,ang#age is navigational1 #ses !onstr#!ts like

  • 7/23/2019 Database Concepts and Architecture

    47/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 4'

    Netork %odel

    Disadvantages4 Navigational and pro!ed#ral nat#re o( pro!essing

    Dataase !ontains a !omple8 array o( pointers

    that thread thro#gh a set o( re!ords. ,ittle s!ope (or a#tomated ?#ery optimization@

  • 7/23/2019 Database Concepts and Architecture

    48/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 4

    'istory o( Data %odels

    ierarchical Data Model: *nitially implemented in a 5oint e((ort y *B% and

    North "meri!an Ro!kell aro#nd GIK. Res#lted

    in the *%S (amily o( systems. *B%9s *%S prod#!t had and still has/ a very large

    !#stomer ase orldide

    'ierar!hi!al model as (ormalized ased on the

    *%S system $ther systems ased on this model4 System 2k

    S"S in!./

  • 7/23/2019 Database Concepts and Architecture

    49/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 4)

    'ierar!hi!al %odel

    "dvantages4 Simple to !onstr#!t and operate

    Corresponds to a n#mer o( nat#ral hierar!hi!ally organized

    domains) e.g.) organization ?org@/ !hart

    ,ang#age is simple4 -ses !onstr#!ts like E&) E& -N*:-E) E& NEH&) E&

    NEH& ;*&'*N 3"REN&) et!.

    Disadvantages4

    Navigational and pro!ed#ral nat#re o( pro!essing Dataase is vis#alized as a linear arrangement o( re!ords

    ,ittle s!ope (or M#ery optimizationM

  • 7/23/2019 Database Concepts and Architecture

    50/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 5*

    'istory o( Data %odels

    elational Model: 3roposed in G70 y E.

  • 7/23/2019 Database Concepts and Architecture

    51/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 51

    'istory o( Data %odels

    O7ect-oriented Data Models: Several models have een proposed (or implementing in a

    dataase system.

    $ne set !omprises models o( persistent $+$ 3rogramming

    ,ang#ages s#!h as C== e.g.) in $B>EC&S&$RE or6ERS"N&/) and Smalltalk e.g.) in E%S&$NE/.

    "dditionally) systems like $2) $R*$N at %CC + then

    *&"SC"/) *R*S at '.3.+ #sed in $pen $$DB/.

    $5e!t Dataase Standard4 $D%+GO) $D%+version 2.0)$D%+version O.0.

    Chapters 20 and 2 des!rie this model.

  • 7/23/2019 Database Concepts and Architecture

    52/53

    Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2- 52

    'istory o( Data %odels

    O7ect-elational Models: %ost Re!ent &rend. Started ith *n(ormi8

    -niversal Server.

    Relational systems in!orporate !on!epts (romo5e!t dataases leading to o5e!t+relational.

    E8empli(ied in the latest versions o( $ra!le+0i)

    DB2) and S:, Server and other DB%Ss.

    Standards in!l#ded in S:,+GG and e8pe!ted to eenhan!ed in (#t#re S:, standards.

    Chapter 22 des!ries this model.

  • 7/23/2019 Database Concepts and Architecture

    53/53

    S#mmary

    Data %odels and &heir Categories 'istory o( Data %odels S!hemas) *nstan!es) and States

    &hree+S!hema "r!hite!t#re Data *ndependen!e DB%S ,ang#ages and *nter(a!es Dataase System -tilities and &ools Centralized and Client+Server "r!hite!t#res Classi(i!ation o( DB%Ss