02 oracle architecture

Upload: cvthiagu

Post on 03-Jun-2018

238 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/12/2019 02 Oracle Architecture

    1/36

    Oracle

    Architecture

    Overview

  • 8/12/2019 02 Oracle Architecture

    2/36

    Oracle Architecture

    The OracleServer

    Oracle server

    Oracle server

  • 8/12/2019 02 Oracle Architecture

    3/36

    Oracle Architecture

    Instance Architecture

    Shared pool

    Library

    Cache

    Data

    Dictionary

    Cache

    Redo

    Lo g

    Buffer

    Database

    Buffer

    Cache

    SGA

    Instance

    DBWR LGWR SO! "O! ARCn

    R#CO C$"% LC$n S!"n Dnnn

    Snnn

  • 8/12/2019 02 Oracle Architecture

    4/36

    Oracle Architecture

    Instance

    An Oracle instance:

    Is a means to access an Oracle data!ase Always o"ens one and only one data!ase

    #onsists o$: Internal memory structures

    %rocesses

  • 8/12/2019 02 Oracle Architecture

    5/36

    Oracle Architecture

    Interaction with the &ata!ase ' &edicated Server (

    SGA

    Re&uest Response

    Shared S'L

    "ool Database Buffer CacheRedo log Buffer

    Database (iles Redo Log (iles

    Dedicated

    Server

    )ser

    "rocess

    DBWR LGWR ARCn

    "O!SO!C$"%

  • 8/12/2019 02 Oracle Architecture

    6/36

    SG A

    Re&uest Response

    Shared S'L

    "ool Database Buffer CacheRedo log Buffer

    Database (iles Redo Log (iles

    )ser

    "rocess

    DBWR LGWR ARCn

    "O!SO!

    Dedicated

    Server

    Dedicated

    Server

    Shared

    Servers

    )ser

    "rocess

    )ser

    "rocess

    )ser

    "rocess

    )ser"rocess

    Dispatcher

    C$"%

    Oracle Architecture

    Interaction with the &ata!ase ' Shared Server (

  • 8/12/2019 02 Oracle Architecture

    7/36

    Oracle Architecture

    Internal Memory Structures S)A

    System or *shared+ )lo!al Area 'S)A(

    &ata!ase !u$$er cache ,edo log !u$$er

    Shared "ool

    ,euest res"onse ueues 'shared server(

  • 8/12/2019 02 Oracle Architecture

    8/36

    Oracle Architecture

    &ata!ase !u$$er cache

    /sed to hold data !locks read $rom data$iles !y server

    "rocesses

    #ontains *dirty+ or modi$ied !locks and *clean+ or

    unused or unchanged !ocks

    *&irty+ and *clean+ !locks are managed in lists called the

    dirty list and the 0,/

    1ree s"ace is created !y &B2, writing out *dirty+

    !locks or aging out !locks $rom the 0,/

    Si3e is managed !y the "arameter

    &B4B0O#54B/116,S

  • 8/12/2019 02 Oracle Architecture

    9/36

    Oracle Architecture

    0east ,ecently /sed '0,/(

    0,/ and the data!ase !u$$er cache

    6very time a data !lock is read $rom disk it is "lacedin the data!ase !u$$er cache at the head o$ the 0,/

    list

    I$ a !lock is already in the cache and it is read again

    it is moved to the head o$ the list

    &ata not used $reuently is *aged+ out o$ the cache

    while $reuently used data remains

  • 8/12/2019 02 Oracle Architecture

    10/36

    Oracle Architecture

    ,edo 0og Bu$$er

    A circular !u$$er that contains redo entries ,edo entries re$lect changes made to the data!ase

    ,edo entries take u" contiguous7 seuentials"ace in the !u$$er

    &ata stored in the redo log !u$$er is "eriodically

    written to the online redo log $iles Si3e is managed !y the "arameter

    0O)4B/116, &e$ault is 8 times the ma9imum data !lock si3e $or

    the o"erating system

  • 8/12/2019 02 Oracle Architecture

    11/36

    Oracle Architecture

    Shared %ool

    #onsists o$ multi"le smaller memory areas 0i!rary cache

    Shared S0 area #ontains "arsed S0 and e9ecution "lans $or statements already run

    against the data!ase

    %rocedure and "ackage storage

    &ictionary cache ;ames o$ all ta!les and views in the data!ase ;ames and dataty"es o$ columns in the data!ase ta!les %rivileges o$ all users

    Managed via an 0,/ algorithm Si3e determined !y the "arameter

    S

  • 8/12/2019 02 Oracle Architecture

    12/36

    Oracle Architecture

    0east ,ecently /sed '0,/(

    0,/ and the shared "ool 6very time a S0 statement is "arsed it is "laced in

    the shared "ool $or reuse

    I$ a S0 statement is already in the shared "ool itwill not re-"arse !ut it is "laced at the head o$ the0,/

    S0 statements not used $reuently are *aged+ outo$ the shared "ool while $reuently used statementsremain

    A S0 statement may !e arti$icially retained at thehead o$ the 0,/ !y *"inning+ the statement

  • 8/12/2019 02 Oracle Architecture

    13/36

    Oracle Architecture

    Internal Memory Structures %)A

    %rogram or *"rocess+ )lo!al Area '%)A( /sed $or a single "rocess

    ;ot sharea!le with other "rocesses

    2rita!le only !y the server "rocess

    Allocated when a "rocess is created anddeallocated when a "rocess is terminated

    #ontains:Sort area /sed $or any sorts reuired !y S0 "rocessingSession in$ormation Includes user "rivileges#ursor state Indicates stage o$ S0 "rocessing

    Stack s"ace #ontains session varia!les

  • 8/12/2019 02 Oracle Architecture

    14/36

    Oracle Architecture

    Background %rocesses - &B2,

    2rites contents o$ data!ase !u$$ers to data$iles

    %rimary >o! is to kee" the data!ase !u$$er*clean+2rites least recently used '0,/( *dirty+ !u$$ers

    to disk $irst

    2rites to data$iles in o"timal !atch writesOnly "rocess that writes directly to data$ilesMandatory "rocess

  • 8/12/2019 02 Oracle Architecture

    15/36

    Oracle Architecture

    Background %rocesses - &B2,

    &B2, writes to disk when:

    A server "rocess cannot $ind a clean reusa!le !u$$er A timeout occurs '? sec(

    A check"oint occurs

    &B2, cannot write out *dirty+ !u$$ers !e$ore they

    have !een written to the online redo log $iles

  • 8/12/2019 02 Oracle Architecture

    16/36

  • 8/12/2019 02 Oracle Architecture

    17/36

    Oracle Architecture

    Background %rocesses - 0)2,

    2rites contents o$ redo log !u$$ers to onlineredo log $iles

    %rimary >o! is to kee" the redo log !u$$er*clean+

    2rites out redo log !u$$er !locks seuentially

    to the redo log $ilesMay write multi"le redo entries "er write during

    high utili3ation "eriodsMandatory "rocess

  • 8/12/2019 02 Oracle Architecture

    18/36

    Oracle Architecture

    Background %rocesses - 0)2,

    0)2, writes to disk when:

    A transaction is #OMMIT6& A timeout occurs '? sec(

    The redo log !u$$er is ? $ull

    There is more than mega!yte o$ redo entries

    Be$ore &B2, writes out *dirty+ !locks to data$iles

  • 8/12/2019 02 Oracle Architecture

    19/36

    Oracle Architecture

    Background %rocesses - SMO;

    %er$orms automatic instance recovery

    ,eclaims s"ace used !y tem"orary segmentsno longer in use

    Merges contiguous areas o$ $ree s"ace in the

    data$iles 'i$ %#TI;#,6AS6 C D(

    SMO; *wakes u"+ regularly to check whether it

    is needed or it may !e called directly

    Mandatory "rocess

  • 8/12/2019 02 Oracle Architecture

    20/36

    Oracle Architecture

    Background %rocesses - SMO;

    SMO; recovers transactions marked as &6A&

    within the instance during instance recovery All non committed work will !e rolled !ack !y SMO;in the event o$ server $ailure

    SMO; makes multi"le "asses through &6A&

    transactions and only a""lies a s"eci$ied num!er o$undo records "er "ass7 this "revents short

    transactions having to wait $or long transactions to

    recover

    SMO; "rimarily cleans u" server-side $ailures

  • 8/12/2019 02 Oracle Architecture

    21/36

  • 8/12/2019 02 Oracle Architecture

    22/36

    Oracle Architecture

    Background %rocesses - %MO;

    &etects !oth user and server a!orted data!ase

    "rocessesAutomatically resolves a!orted "rocesses

    %MO; rolls !ack the current transaction o$ the

    a!orted "rocess

    ,eleases resources used !y the "rocess I$ the "rocess is a !ackground "rocess the instance

    most likely cannot continue and will !e shut down

    %MO; "rimarily cleans u" client-side $ailures

  • 8/12/2019 02 Oracle Architecture

    23/36

    Oracle Architecture

    Background %rocesses - #5%T

    1orces all modi$ied data in the S)A to !e written todata$ile

    Occurs whether or not the data has !een committed #5%T does not actually write out !u$$er data only &B2, can

    write to the data$iles

    /"dates the data$ile headers This ensures all data$iles are synchroni3ed

    usted with "arameters

  • 8/12/2019 02 Oracle Architecture

    24/36

    Oracle Architecture

    Background %rocesses - A,#