Less01 Architecture

download Less01 Architecture

of 38

Transcript of Less01 Architecture

  • 5/21/2018 Less01 Architecture

    1/38Copyright 2009, Oracle. All rights reserved.

    Exploring the Oracle Database Architecture

  • 5/21/2018 Less01 Architecture

    2/38Copyright 2009, 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 Describe ASM storage components

  • 5/21/2018 Less01 Architecture

    3/38Copyright 2009, Oracle. All rights reserved.1 - 3

    Oracle Database

    The Oracle relational database management system (RDBMS)

    provides an open, comprehensive, integrated approach to

    information management

  • 5/21/2018 Less01 Architecture

    4/38Copyright 2009, Oracle. All rights reserved.1 - 4

    Connecting to a Server

    Client Middle tier Server

    Multitier architecture shown

  • 5/21/2018 Less01 Architecture

    5/38Copyright 2009, Oracle. All rights reserved.1 - 6

    Database (Storage Structures)

    Oracle Database Server Architecture:

    Overview

    Serverprocess

    PGA

    User

    process

    Instance

    Memory Structures

    (System Global Area)

    Process Structures

    Client

    Server

  • 5/21/2018 Less01 Architecture

    6/38Copyright 2009, Oracle. All rights reserved.1 - 7

    Instance: Database Configurations

    D1

    D2

    I1

    I2I1 I2 I3

    D

    Clustered SystemNonclustered System

    Local

    Storage

    Shared Storage

  • 5/21/2018 Less01 Architecture

    7/38Copyright 2009, Oracle. All rights reserved.1 - 8

    Connecting to the Database Instance

    Connection: Communication between a user process and

    an instance

    Session: Specific connection of a user to an instancethrough a user process

    SQL> Select

    Session

    Connection

    User

    User

    process

    Server

    process

    Session

  • 5/21/2018 Less01 Architecture

    8/38Copyright 2009, Oracle. All rights reserved.1 - 9

    Oracle Database Memory Structures

    Server

    process 1

    Shared pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    poolLarge poolJava pool

    Stack

    Space

    System Global Area (SGA)

    Program Global Area (PGA)

    Server

    process 2

    KEEP

    buffer pool

    RECYCLE

    buffer pool

    nK buffer

    cache

    User

    Global

    Area

    Stack

    Space

    User

    Global

    Area

    PGA

  • 5/21/2018 Less01 Architecture

    9/38

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

    Shared pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    poolLarge poolJava pool

    System Global Area (SGA)

    KEEP

    buffer pool

    RECYCLE

    buffer pool

    nK buffer

    cache

    Shared Pool

    Is a portion of the SGA

    Contains:

    Library cache Shared SQL area

    Data dictionary cache

    Control structures

    SharedSQL area

    Library

    cache

    Data dictionarycache

    Other

    Fixed Area

  • 5/21/2018 Less01 Architecture

    10/38

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

    Shared pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    poolLarge poolJava pool

    System Global Area (SGA)

    KEEP

    buffer pool

    RECYCLE

    buffer pool

    nK buffer

    cache

    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

  • 5/21/2018 Less01 Architecture

    11/38

    Copyright 2009, 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 redochanges made by operations such as DML and DDL

    Shared pool

    Database

    buffer

    cache

    Streams

    poolLarge poolJava pool

    System Global Area (SGA)

    KEEP

    buffer pool

    RECYCLE

    buffer pool

    nK buffer

    cache

    Redo log

    buffer

  • 5/21/2018 Less01 Architecture

    12/38

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

    Shared pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    poolLarge poolJava pool

    System Global Area (SGA)

    KEEP

    buffer pool

    RECYCLE

    buffer pool

    nK buffer

    cache

    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

    Parallel

    QueryAdvanced

    Queuing

  • 5/21/2018 Less01 Architecture

    13/38

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

    Shared pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    poolLarge poolJava pool

    System Global Area (SGA)

    KEEP

    buffer pool

    RECYCLE

    buffer pool

    nK buffer

    cache

    Java Pool

    and Streams Pool Java pool memory is used to store all session-specific

    Java code and data in the JVM.

    Streams pool memory is used exclusively by OracleStreams to:

    Store buffered queue messages

    Provide memory for Oracle Streams processes

    Java pool Streams pool

  • 5/21/2018 Less01 Architecture

    14/38

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

    Program Global Area (PGA)

    Server

    process 1

    Stack

    Space

    System Global Area (SGA)

    PGA

    Shared pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    poolLarge poolJava pool

    KEEP

    buffer pool

    RECYCLEbuffer pool

    nK buffer

    cache

    User

    Global

    Area

    User Session

    Data

    Cursor

    State

    Sort

    Area

    Hash

    Area

    Create Bitmap Area

    SQL

    Working Areas

    Bitmap Merge Area

  • 5/21/2018 Less01 Architecture

    15/38

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

    Quiz

    Memory region that contains data and control information for a

    server or background process is called:

    1. Shared Pool2. PGA

    3. Buffer Cache

    4. User session data

  • 5/21/2018 Less01 Architecture

    16/38

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

    Quiz

    What is read into the Database Buffer Cache from the data

    files?

    1. Rows2. Changes

    3. Blocks

    4. SQL

  • 5/21/2018 Less01 Architecture

    17/38

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

    Process Architecture

    User process

    Is the application or tool that connects to the 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 instanceis started

    Daemon / Application processes

    Networking listeners Grid infrastructure daemons

  • 5/21/2018 Less01 Architecture

    18/38

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

    Process Structures

    PMONSMON

    Others

    Instances (ASM and Database separate)

    RECO

    ARCn

    DBWn LGWRCKPT

    PGA

    Background processes

    System Global Area (SGA)

    Required:

    ASMB RBALOptional:

    Grid Infrastructure Processes

    (ASM and Oracle Restart)

    orarootagent

    ohas ocssd diskmon

    oraagent cssdagent

    User

    process

    Server

    process

    Listener

  • 5/21/2018 Less01 Architecture

    19/38

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

    Database Writer Process (DBWn)

    Writes modified (dirty) buffers in the database buffer cache to

    disk:

    Asynchronously while performing other processing To advance the checkpoint

    Database buffer

    cache

    Database writer

    process

    Data files

    DBWn

  • 5/21/2018 Less01 Architecture

    20/38

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

    Log Writer 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

    Every 3 seconds

    Redo log buffer Log Writer process Redo log files

    LGWR

  • 5/21/2018 Less01 Architecture

    21/38

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

    Checkpoint Process (CKPT)

    Records checkpoint information in

    Control file

    Each data file header

    Checkpoint

    process

    Data files

    Control fileCKPT

  • 5/21/2018 Less01 Architecture

    22/38

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

    System Monitor Process (SMON)

    Performs recovery at instance startup

    Cleans up unused temporary segments

    Instance

    Temporary

    segment

    System Monitor

    process

    SMON

  • 5/21/2018 Less01 Architecture

    23/38

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

    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

    process

    Database buffer

    cacheFailed user

    process

    User

    PMON

    Server

    process

    tnslsnr

  • 5/21/2018 Less01 Architecture

    24/38

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

    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-doubt

    transactions

    Recoverer process

    in database A

    In-doubt transaction

    in database B

    RECO

  • 5/21/2018 Less01 Architecture

    25/38

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

    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 tostandby destinations

    Archiver process Archive destinationCopies of redo log

    files

    ARCn

  • 5/21/2018 Less01 Architecture

    26/38

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

    Oracle Grid Infrastructure is started by the OS init daemon.

    Oracle Grid Infrastructure installation modifies the

    /etc/inittab file to ensure startup every time machineis started in corresponding run level.

    Process Startup Sequence

    init.ohasd

    (root)

    ohasd.bin

    oraagent.bin

    orarootagent.bin

    diskmon.bincssdagent

    ocssd.bin

    init

    Grid Infrastructure

    Wrapper ScriptGrid Infrastructure

    Daemons and Processes

    Operating System

    Init Daemon

    # cat /etc/inittab

    ..

    h1:35:respawn:/etc/init.d/init.ohasd run >/dev/null 2>&1

  • 5/21/2018 Less01 Architecture

    27/38

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

    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

  • 5/21/2018 Less01 Architecture

    28/38

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

    Logical and Physical Database Structures

    Database

    Logical Physical

    Tablespace Data file

    Segment

    Extent

    Oracle datablock

    Storage System

    SAN

    NAS

    Exadata

    File System

    NFS

    ASM

    RAW

  • 5/21/2018 Less01 Architecture

    29/38

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

    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

    Disk blocks(File System

    Storage)

  • 5/21/2018 Less01 Architecture

    30/38

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

    Tablespaces and Data Files

    8Kb 8Kb

    8Kb 8Kb

    8Kb 8Kb

    8Kb 8Kb

    8Kb 8Kb

    8Kb 8Kb

    8Kb 8Kb

    8Kb 8Kb

    8Kb

    8Kb

    8Kb

    8Kb

    Tablespace 1

    Datafile 1 Datafile 2

    Extent

    64KB

    Extent

    96KB

    Segment

    160KB

    Tablespace 2 (Bigfile)

    Datafile 3

    Only 1 datafile

    allowed

  • 5/21/2018 Less01 Architecture

    31/38

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

    SYSTEMand SYSAUX Tablespaces

    The SYSTEM and SYSAUX tablespaces are mandatory

    tablespaces that are created at the time of database

    creation. They must be online.

    The SYSTEM tablespace is used for core functionality (for

    example, data dictionary tables).

    The auxiliary SYSAUX tablespace is used for additional

    database components (such as the Enterprise ManagerRepository).

    The SYSTEM and SYSAUX tablespaces are not

    recommended to be used to store application's data.

  • 5/21/2018 Less01 Architecture

    32/38

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

    Automatic Storage Management

    Is a portable and high-performance

    cluster file system

    Manages Oracle database files Manages application files with

    ASM Cluster File System (ACFS)

    Spreads data across disks

    to balance load

    Mirrors data in case of failures

    Solves storage-management

    challenges

    ASM

    Cluster FileSystem

    ASM Dynamic

    Volume

    Manager

    Application OracleDatabase

    Operating system

    ASM

    Files for

    Oracle

    Database

    Automatic Storage Management

  • 5/21/2018 Less01 Architecture

    33/38

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

    ASM Storage Components

    Oracle

    Databasedatafile

    ASM allocationunit

    ASMdisk group

    ASM disk

    ASM file

    ASMextent

    File systemor

    Raw device

    ASM

  • 5/21/2018 Less01 Architecture

    34/38

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

    Interacting with an Oracle Database:

    Memory, Processes and Storage

    User

    PGA

    Userprocess

    Server

    process

    Listener

    PMONSMON Others

    Instance

    RECODBWn

    LGWRCKPT

    Shared

    pool

    Database

    buffer

    cache

    Redo log

    buffer

    Streams

    poolLarge pool

    Java

    pool

    KEEP

    buffer

    RECYCLE buffer

    nK buffer

    cache

    ARCn

  • 5/21/2018 Less01 Architecture

    35/38

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

    Quiz

    The Process Monitor process (PMON):

    1. Performs recovery at instance startup

    2. Performs process recovery when a user process fails3. Automatically resolves all in-doubt transactions

    4. Writes the redo log buffer to a redo log file

  • 5/21/2018 Less01 Architecture

    36/38

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

    Quiz

    ASM Files are accessed by which types of instances?

    1. RDBMS Instances only

    2. ASM Instances only3. Both RDBMS and ASM Instances

  • 5/21/2018 Less01 Architecture

    37/38

    Copyright 2009, Oracle. All rights reserved.1 - 46

    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 Describe the ASM storage components

    O

  • 5/21/2018 Less01 Architecture

    38/38

    Copyright 2009, Oracle. All rights reserved.1 - 47

    Practice 1: Overview

    This is a paper practice with questions about:

    Database architecture

    Memory Processes

    File structures