less01_exploring oracle database architecture

Upload: anon826064708

Post on 07-Apr-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    1/46

    Copyright 2008, Oracle. All rights reserved.

    Exploring the Oracle Database Architecture

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    2/46

    Copyright 2008, Oracle. All rights reserved.1 - 2

    Objectives

    After completing this lesson, you should be able to:

    List the major architectural components of Oracle

    Database

    Explain the memory structures

    Describe the background processes

    Correlate the logical and physical storage structures

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    3/46

    Copyright 2008, Oracle. All rights reserved.1 - 3

    Oracle Database

    The Oracle relational database management system

    (RDBMS) provides an open, comprehensive, integrated

    approach to information management

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    4/46

    Copyright 2008, Oracle. All rights reserved.1 - 4

    Connecting to a Server

    Client Middle tier Server

    Multitier architecture shown

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    5/46

    Copyright 2008, Oracle. All rights reserved.1 - 5

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    6/46

    Copyright 2008, Oracle. All rights reserved.1 - 6

    Database

    Data filesOnline redo

    log files

    Controlfiles

    Oracle Database Architecture: Overview

    Database

    buffer

    cache

    Shared pool

    Data dictionarycache

    Library

    cache

    PMONSMON Others

    Server

    process

    PGA

    Archived

    log filesUser

    process

    Instance

    RECO

    ARCn

    SGA

    DBWn

    Redo log

    buffer

    LGWRCKPT

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    7/46

    Copyright 2008, Oracle. All rights reserved.1 - 7

    Connecting to the Database

    Connection: Communication between a user process

    and an instance

    Session: Specific connection of a user to an instance

    through a user process

    SQL> Select Session

    Connection

    User

    User

    process

    Server

    process

    Session

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    8/46

    Copyright 2008, Oracle. All rights reserved.1 - 8

    Interacting with an Oracle Database

    User

    Database

    buffer

    cache

    Shared pool

    Data dictionary

    cache

    Library

    cache

    PMONSMON Others

    Instance

    RECOARCn

    SGA

    DBWn

    Redo log

    buffer

    LGWRCKPT

    User

    process

    Server

    process

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    9/46

    Copyright 2008, Oracle. All rights reserved.1 - 9

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    10/46

    Copyright 2008, Oracle. All rights reserved.1 - 10

    Database

    Oracle Database Server Structures

    PMONSMON Others

    Data filesOnline redo

    log filesControl

    files

    Instance

    RECOARCnDBWn LGWRCKPT

    Storage structures

    User

    process

    Server

    process

    Memory structures

    Processes

    Database

    buffer

    cache

    Shared pool

    Data dictionary

    cache

    Library

    cache

    SGA

    Redo log

    buffer

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    11/46

    Copyright 2008, Oracle. All rights reserved.1 - 11

    Oracle Database

    Memory Structures

    DB structures

    Memory

    - Process

    - Storage

    SGA

    Database buffer

    cache

    Redo log

    buffer

    Java

    pool

    Streams

    pool

    Shared pool

    Large pool

    PGA PGA PGABackground

    process

    Server

    process 1

    Server

    process 2

    Shared

    SQL area

    Library

    cache

    Data dictionarycache

    Other

    I/O buffer

    Response

    queue

    Request

    queue

    Freememory

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    12/46

    Copyright 2008, Oracle. All rights reserved.1 - 12

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    13/46

    Copyright 2008, Oracle. All rights reserved.1 - 13

    Database Buffer Cache

    Is part of the SGA

    Holds copies of data blocks that are read from data files

    Is shared by all concurrent users

    PMONSMON Others

    Instance

    RECOARCnDBWn LGWRCKPT

    Database

    buffercache

    Shared pool

    Data dictionary

    cache

    Library

    cache

    SGA

    Redo log

    buffer

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    14/46

    Copyright 2008, Oracle. All rights reserved.1 - 14

    Redo Log Buffer

    Is a circular buffer in the SGA

    Holds information about changes made to the database

    Contains redo entries that have the information to redo

    changes made by operations such as DML and DDL

    PMONSMON Others

    Instance

    RECOARCnDBWn LGWRCKPT

    Database

    buffercache

    Shared pool

    Data dictionary

    cache

    Library

    cache

    SGA

    Redo log

    buffer

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    15/46

    Copyright 2008, Oracle. All rights reserved.1 - 15

    Shared Pool

    Is a portion of the SGA

    Contains:

    Library cache

    Shared SQL area

    Data dictionary cache Control structures

    PMONSMON Others

    Instance

    RECOARCnDBWn LGWRCKPT

    Shared

    SQL area

    Library

    cache

    Data dictionary

    cache

    Other

    Databasebuffer

    cache

    Shared pool

    Data dictionary

    cache

    Library

    cache

    SGA

    Redo log

    buffer

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    16/46

    Copyright 2008, Oracle. All rights reserved.1 - 16

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    17/46

    Copyright 2008, Oracle. All rights reserved.1 - 17

    Allocation and Reuse of Memory

    in the Shared Pool

    Server process checks the shared pool to see if a

    shared SQL area already exists for an identical

    statement.

    Server process allocates a private SQL area on behalf of

    the session.

    Server

    process

    Shared

    pool

    Shared

    SQL area

    Library

    cache

    Data dictionary

    cache

    Other

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    18/46

    Copyright 2008, Oracle. All rights reserved.1 - 18

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    19/46

    Copyright 2008, Oracle. All rights reserved.1 - 19

    Large Pool

    Provides large memory allocations for:

    Session memory for the shared server and the Oracle

    XA interface

    I/O server processes

    Oracle Database backup and restore operations

    Large pool

    I/O buffer

    Response

    queue

    Request

    queue

    Free

    memory

    Java

    poolLarge pool

    Shared pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    pool

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    20/46

    Copyright 2008, Oracle. All rights reserved.1 - 20

    Java Pool

    and Streams Pool

    Java pool memory is used in server memory for all

    session-specific Java code and data in the JVM.

    Streams pool memory is used exclusively by Oracle

    Streams to:

    Store buffered queue messages Provide memory for Oracle Streams processes

    Java pool Streams pool

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    21/46

    Copyright 2008, Oracle. All rights reserved.1 - 21

    Process Architecture

    User process Is started when a database user or a batch process

    connects to Oracle Database

    Database processes

    Server process: Connects to the Oracle instance and is

    started when a user establishes a session Background processes: Are started when an Oracle

    instance is started

    DB structures

    - Memory

    Process

    - Storage

    PMONSMON Others

    Instance

    RECOARCnDBWn LGWRCKPT

    PGA

    User

    process

    Server

    process Background processes

    Databasebuffer

    cache

    Shared pool

    Data dictionary

    cache

    Library

    cache

    SGA

    Redo log

    buffer

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    22/46

    Copyright 2008, Oracle. All rights reserved.1 - 22

    Process Structures

    Servern

    processes

    SGA

    Oracle

    background

    processes

    PMON SMON OthersRECO ARCnDBWn LGWRCKPT

    Server ServerServerServer Server

    Database

    buffer

    cache

    Shared pool

    Data dictionary

    cache

    Library

    cache

    SGA

    Redo log

    buffer

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    23/46

    Copyright 2008, Oracle. All rights reserved.1 - 23

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    24/46

    Copyright 2008, Oracle. All rights reserved.1 - 24

    Database Writer Process (DBWn)

    Writes modified (dirty) buffers in the database buffer cache

    to disk:

    Asynchronously while performing other processing

    Periodically to advance the checkpoint

    Database buffer

    cache

    Database writer

    process

    Data files

    DBWn

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    25/46

    Copyright 2008, Oracle. All rights reserved.1 - 25

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    26/46

    Copyright 2008, Oracle. All rights reserved.1 - 26

    LogWriter Process (LGWR)

    Writes the redo log buffer to a redo log file on disk

    Writes:

    When a user process commits a transaction

    When the redo log buffer is one-third full

    Before a DBWn process writes modified buffers to disk

    Redo log buffer LogWriter process Redo log files

    LGWR

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    27/46

    Copyright 2008, Oracle. All rights reserved.1 - 27

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    28/46

    Copyright 2008, Oracle. All rights reserved.1 - 28

    Checkpoint Process (CKPT)

    Records checkpoint information in

    Control file

    Each data file header

    Checkpointprocess

    Data files

    Control fileCKPT

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    29/46

    Copyright 2008, Oracle. All rights reserved.1 - 29

    System Monitor Process (SMON)

    Performs recovery at instance startup

    Cleans up unused temporary segments

    Instance

    Temporary

    segment

    System Monitorprocess

    SMON

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    30/46

    Copyright 2008, Oracle. All rights reserved.1 - 30

    Process Monitor Process (PMON)

    Performs process recovery when a user process fails

    Cleans up the database buffer cache

    Frees resources that are used by the user process

    Monitors sessions for idle session timeout

    Dynamically registers database services with listeners

    Process Monitor

    processDatabase buffer

    cache

    Failed user

    process

    UserPMON

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    31/46

    Copyright 2008, Oracle. All rights reserved.1 - 31

    Recoverer Process

    Used with the distributed database configuration

    Automatically connects to other databases involved in

    in-doubt distributed transactions

    Automatically resolves all in-doubt transactions

    Removes any rows that correspond to in-doubttransactions

    Recoverer process

    in database A

    In-doubt transaction

    in database B

    RECO

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    32/46

    Copyright 2008, Oracle. All rights reserved.1 - 32

    Archiver Processes (ARCn)

    Copy redo log files to a designated storage device after

    a log switch has occurred

    Can collect transaction redo data and transmit that data

    to standby destinations

    Archiver process Archive destinationCopies of redo log

    files

    ARCn

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    33/46

    Copyright 2008, Oracle. All rights reserved.1 - 33

    Other Processes

    MMON: Performs manageability-related background

    tasks

    MMNL: Performs frequent and lightweight

    manageability-related tasks

    MMAN: Performs automatic memory management tasks CJQ0: Runs user jobs used in batch processing

    QMNC: Monitors the Streams Advanced Queuing

    message queues

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    34/46

    Copyright 2008, Oracle. All rights reserved.1 - 34

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    35/46

    Copyright 2008, Oracle. All rights reserved.1 - 35

    Server Process and Database

    Buffer Cache

    Buffers:

    Pinned

    Clean

    Free or unused Dirty

    Database

    writer

    process

    Database

    buffer

    cache

    SGA

    Data files

    DBWn

    Server

    process

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    36/46

    Copyright 2008, Oracle. All rights reserved.1 - 36

    Database Storage Architecture

    Online redo log files

    Password file

    Parameter file Archived redo log

    files

    Control files Data files

    Alert log and trace files

    Backup files

    DB structures

    - Memory

    - Process

    Storage

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    37/46

    Copyright 2008, Oracle. All rights reserved.1 - 37

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    38/46

    Copyright 2008, Oracle. All rights reserved.1 - 38

    Logical and Physical Database Structures

    Database

    Logical Physical

    Tablespace Data file

    OS block

    Segment

    Extent

    Oracle datablock

    Schema

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    39/46

    Copyright 2008, Oracle. All rights reserved.1 - 39

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    40/46

    Copyright 2008, Oracle. All rights reserved.1 - 40

    Tablespaces and Data Files

    Tablespaces consist of one or more data files.

    Data files belong to only one tablespace.

    USERS tablespace

    Data file 1 Data file 2

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    41/46

    Copyright 2008, Oracle. All rights reserved.1 - 41

    SYSTEMand SYSAUX Tablespaces

    The SYSTEMand SYSAUX tablespaces are mandatory

    tablespaces that are created at the time of database

    creation. They must be online.

    The SYSTEMtablespace is used for core functionality

    (for example, data dictionary tables). The auxiliary SYSAUX tablespace is used for additional

    database components (such as the Enterprise Manager

    Repository).

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    42/46

    Copyright 2008, Oracle. All rights reserved.1 - 42

    Segments, Extents, and Blocks

    Segments exist in a tablespace.

    Segments are collections of extents.

    Extents are collections of data blocks.

    Data blocks are mapped to disk blocks.

    Segment Extents Datablocks

    Diskblocks

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    43/46

    Copyright 2008, Oracle. All rights reserved.1 - 43

    Database Architecture:

    Summary of Structural Components

    Memory structures:

    System Global Area (SGA): Database buffer cache, redo

    buffer, and various pools

    Program Global Area (PGA)

    Process structures: User process and server process

    Background processes: SMON, PMON, DBWn, CKPT,

    LGWR, ARCn, and so on

    Storage structures:

    Logical: Database, schema, tablespace, segment, extent,and Oracle block

    Physical: Data files, control files, and redo log files

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    44/46

    Copyright 2008, Oracle. All rights reserved.1 - 44

    Summary

    In this lesson, you should have learned how to:

    List the major architectural components of Oracle

    Database

    Explain the memory structures

    Describe the background processes Correlate the logical and physical storage structures

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    45/46

    Copyright 2008, Oracle. All rights reserved.1 - 45

    Practice 1: Overview

    This is a paper practice with questions about:

    Database architecture

    Memory

    Processes

    File structures

  • 8/6/2019 Less01_Exploring Oracle Database Architecture

    46/46

    C i h 2008 O l All i h d1 46