02_DB Architecture Overview.ppt

download 02_DB Architecture Overview.ppt

of 58

Transcript of 02_DB Architecture Overview.ppt

  • 8/11/2019 02_DB Architecture Overview.ppt

    1/58

    Database Architecture Overview

  • 8/11/2019 02_DB Architecture Overview.ppt

    2/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Transactions

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    3/58

    Oracle Server Architecture

    An Oracle server: Is a database management

    system that provides an

    open, comprehensive,

    integrated approach toinformation management

    Consists of an Oracle

    instance and an Oracle

    database

    Oracle Server

  • 8/11/2019 02_DB Architecture Overview.ppt

    4/58

    Overview of Primary Components

    Instance

    SGA

    Redo log

    buffer cache

    Shared pool

    Data Dict.

    cache

    Library

    cache

    DBWRSMONPMON CKPTLGWR Others

    Userprocess

    Server

    process

    PGA

    Controlfiles

    Datafiles Archived

    log filesParameter

    file

    Password

    file

    Redo logfiles

    Database

    Database

    buffer cache

  • 8/11/2019 02_DB Architecture Overview.ppt

    5/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    6/58

    Oracle Instance

    Is a means to access an Oracle database

    Always opens one and only one database

    Consists of memory and process structures

    Background

    structures

    Memory

    structures

    SGA

    Redo logbuffer cache

    Databasebuffer cache

    Shared pool

    DBWRSMONPMON CKPTLGWR Others

    Data Dictionary

    cache

    Library

    cache

    Instance

  • 8/11/2019 02_DB Architecture Overview.ppt

    7/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    8/58

    Physical Structure

    The physical structure of an Oracle database isdetermined by the operating system files that

    provide the actual physical storage for database

    information.

    Control files

    Data files

    Redo log files Controlfiles

    Data files

    (includes

    datadictionary)

    Header

    Online

    redo log

    files)

  • 8/11/2019 02_DB Architecture Overview.ppt

    9/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    10/58

    Parameter Files

    Control Files

    Data Files

    Redo Log Files Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    11/58

    Oracle Database

    Controlfiles

    Datafiles Archived

    log filesParameter

    file

    Password

    file

    Redolog files

    Oracle Database

  • 8/11/2019 02_DB Architecture Overview.ppt

    12/58

    Parameter Files

    Control Files

    Data Files

    Redo Log Files Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    13/58

    Parameter Files

    Entries are specific to the instance being accessed

    There are two kinds of parameters:

    Explicit: Having an entry in the file

    Implicit: No entry within the file, but assuming the Oracle

    default values

    Multiple files can be used for a single database to

    optimize performance in different situations.

  • 8/11/2019 02_DB Architecture Overview.ppt

    14/58

  • 8/11/2019 02_DB Architecture Overview.ppt

    15/58

    Parameter Files

    Control Files

    Data Files

    Redo Log Files Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    16/58

    Control FileThe control file is a binary file that defines the

    current state of the physical database.. Loss of the control file requires recovery

    Is read at MOUNTstage

    Is required to operate

    Is linked to a single database Should be multiplexed

    Maintains integrity of database

    Sized initially by

    CREATE DATABASE

    Controlfiles

    Database

  • 8/11/2019 02_DB Architecture Overview.ppt

    17/58

    Parameter Files

    Control Files

    Data Files

    Redo Log Files Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    18/58

    Parameter Files

    Control Files Data Files

    Tablespaces

    Oracle Managed Files

    Data Block

    Data Types

    Tables

    Indexes Redo Log Files

    Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    19/58

    Logical Structure

    The logical structure of the Oracle architecturedictates how the physical space of a database is to be used.

    A hierarchy exists in this structure that consists of

    tablespaces, segments, extents, and blocks.

    Tablespace

    Data file

    Segment

    BlocksExtent

    Segment

  • 8/11/2019 02_DB Architecture Overview.ppt

    20/58

    SYSTEMand Non-SYSTEMTablespaces

    SYSTEMtablespace:

    Created with the database

    Contains the data dictionary

    Contains the SYSTEMundo segment

    Non-SYSTEMtablespaces:

    Separate segments

    Ease space administration

    Control amount of space allocated to a user

  • 8/11/2019 02_DB Architecture Overview.ppt

    21/58

    Parameter Files

    Control Files

    Data Files

    Tablespaces

    Oracle Managed Files

    Data Block Data Types

    Tables

    Indexes Redo Log Files

    Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    22/58

    Oracle Managed Files

    Oracle Managed Files (OMF) simplify file

    administration by eliminating the need to directly

    manage the files in an Oracle database

    This feature has two major thrusts: Allows database objects to be created without

    specifying the underlying operating system files

    Automatically removes obsolete data files and online

    redo logs

  • 8/11/2019 02_DB Architecture Overview.ppt

    23/58

    Parameter Files

    Control Files Data Files

    Tablespaces

    Oracle Managed Files

    Data Block

    Data Types Tables

    Indexes Redo Log Files

    Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    24/58

    Database Block

    Minimum unit of I/O

    Consists of one or more OS blocks

    Set at tablespace creation

    DB_BLOCK_SIZEis the default block size

  • 8/11/2019 02_DB Architecture Overview.ppt

    25/58

    Parameter Files

    Control Files

    Data Files

    Tablespaces

    Oracle Managed Files

    Data Block

    Data Types Tables

    Indexes Redo Log Files

    Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    26/58

    Oracle data types

    CHAR(N), NCHAR(N)

    VARCHAR2(N),

    NVARCHAR2(N)

    NUMBER(P,S)

    DATE

    RAW(N)BLOB, CLOB,

    NCLOB, BFILE

    LONG, LONG RAW

    ROWID

    VARRAY

    TABLE

    REF

    Data type

    Built-inUser-defined

    Scalar RelationshipCollection

  • 8/11/2019 02_DB Architecture Overview.ppt

    27/58

    System-Provided Datatypes

    Built-In Datatype

    CHARACTER

    DATE

    NUMBER

    LOB

    RAW

    ROWID

    Native Datatypes

    ANSI

    DB2

    SQL/DS

    Support Datatypes

    PL/SQL Datatypes

    BOOLEAN

    BINARY_INTEGER

    Extended Datatypes

    Text

    Image

    Video

    Audio

    Spatial

    XML

    Time Series

  • 8/11/2019 02_DB Architecture Overview.ppt

    28/58

    Parameter Files

    Control Files

    Data Files

    Tablespaces

    Oracle Managed Files

    Data Block

    Data Types

    Tables

    Indexes Redo Log Files

    Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    29/58

    Tables in Oracle

    Regular table

    Cluster

    Partitionedtable

    Index-organized

    table

  • 8/11/2019 02_DB Architecture Overview.ppt

    30/58

    Parameter Files

    Control Files Data Files

    Tablespaces

    Oracle Managed Files

    Data Block Data Types

    Tables

    Indexes Redo Log Files

    Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    31/58

    Classification of Indexes

    Logical Single column or concatenated

    Unique or nonunique

    Function Based

    Domain Based

    Physical

    Partitioned or nonpartitioned

    B-tree

    Normal or reverse key

    Bitmap

    Bitmap Join Index

  • 8/11/2019 02_DB Architecture Overview.ppt

    32/58

    Parameter Files

    Control Files

    Data Files

    Redo Log Files Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    33/58

    Using Redo Log Files

    Redo log files record all changes made to data and

    provide a recovery mechanism from a system or

    media failure.

    Redo log files are organized into groups.

    An Oracle database requires at least two groups.

    Each redo log within a group is

    called a member.

    Redolog files

    Database

  • 8/11/2019 02_DB Architecture Overview.ppt

    34/58

    Structure of Redo Log Files

    Group 2 Group 3Group 1

    Member

    Disk 1

    Disk 2Member

    Member Member

    MemberMember

  • 8/11/2019 02_DB Architecture Overview.ppt

    35/58

    How Redo Logs Work

    Redo logs are used in a cyclic fashion.

    When a redo log file is full, LGWR will move to the

    next log group.

    This is called a log switch Checkpoint operation also occurs

    Information is written to the control file

  • 8/11/2019 02_DB Architecture Overview.ppt

    36/58

    Parameter Files

    Control Files

    Data Files

    Redo Log Files Undo Data Files

    Database Files

  • 8/11/2019 02_DB Architecture Overview.ppt

    37/58

    Undo Data Overview

    Before Oracle makes a change to a database

    block it is copied to the Undo area.

    Used for Rollback and Read Consistency.

  • 8/11/2019 02_DB Architecture Overview.ppt

    38/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Transactions

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    39/58

    Process Structure

    An Oracle process is a program that depending on itstype can request information, execute a series ofsteps, or perform a specific task.On some OS (MS Windows) these are actually implemented as

    process threads.Oracle takes advantage of various types of

    processes: User process: Started at the time a database user requests

    connection to the Oracle server

    Server process: Connects to the Oracle Instance and is startedwhen a user establishes a session.

    Background process: Available when an Oracle instance isstarted

  • 8/11/2019 02_DB Architecture Overview.ppt

    40/58

    Background Processes

    The relationship between the physical and memory

    structures is maintained and enforced by Oracles

    background processes.

    Mandatory background processes

    DBWn PMON CKPT

    LGWR SMON and others

    Optional background processesARCn LMON Snnn

    QMNn LMDn RECO

    CJQ0 Pnnn and others

    LCKn Dnnn

  • 8/11/2019 02_DB Architecture Overview.ppt

    41/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Transactions

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    42/58

    Memory Structure

    Oracles memory structure consists of two memory

    areas known as:

    System Global Area (SGA): Allocated at instance

    startup, and is a fundamental component of an

    Oracle Instance

    Program Global Area (PGA): Allocated when the

    server process is started

  • 8/11/2019 02_DB Architecture Overview.ppt

    43/58

    System Global Area (SGA)

    The SGA consists of several memory structures:

    Shared pool

    Database buffer cache

    Redo log buffer Other structures (e.g. lock and latch

    management, statistical data)

  • 8/11/2019 02_DB Architecture Overview.ppt

    44/58

    System Global Area (SGA)

    SGA is dynamic and sized using MEMORY_TARGETwithoutshutting down the instance

    SGA memory allocated and tracked in granules by SGAcomponents

    Contiguous virtual memory allocation

    Size based on MEMORY_TARGET

  • 8/11/2019 02_DB Architecture Overview.ppt

    45/58

    Program Global Area (PGA)

    The PGA is memory reserved for each user process

    that connects to an Oracle database.Managed as part of the MEMORY_TARGET

    User

    process

    Stackspace

    Sessioninformation

    sort area, cursorinformation

    SGA

    Shared SQL areas

    SGA

    Sessioninformation

    PGA Dedicated server Shared server

    Serverprocess

    Shared SQL areas

    Stackspace

    sort area, cursorinformation

  • 8/11/2019 02_DB Architecture Overview.ppt

    46/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Transactions

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    47/58

    Transactions

    Oracle has an implicit transaction model.

    A transaction starts immediately after the last one

    completes

    Can be made READ-ONLY via ALTER

    TRANSACTION command

    COMMIT or ROLLBACK ends transaction

  • 8/11/2019 02_DB Architecture Overview.ppt

    48/58

    Oracles Multi-Version ConcurrencyRead Consistent Row Locking

    With Oracle report

    update UndoTablespace

    BeforeImage

    accuratereport

    Budget Table Updates dont lockout reports and

    reports dont lockout updates

    Reports see only committed datavia Multi-Versioning

    Queries yield maximumthroughput with correct results -no waiting and no dirty reads!

    Row locks never escalate - themost scaleable solution available

  • 8/11/2019 02_DB Architecture Overview.ppt

    49/58

    Multi Version Read Consistency High

    Throughput Concurrency

    Performance Table stakes Oracle Microsoft Sybase

    Unique Concurrency Model Yes No No

    Readers Dont Block Writers Yes No* No

    Writers Dont Block Readers Yes No* No

    Guarantees Consistent Queries Yes Yes No

    Eliminates Lock Escalation Yes No No

    Reduces Deadlocks under Load Yes No No

    Oracle does not compromise data accuracy for greater concurrency*Except when using Snapshots in SS 2005

  • 8/11/2019 02_DB Architecture Overview.ppt

    50/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Transactions

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    51/58

    Data Dictionary

    During database creation, the Oracle server createsadditional object structures within the data files.

    Data dictionary tables

    Dynamic performance tables

    Controlfiles

    Datafiles

    Redologfiles

    Database

    Data Dictionary Tables

    Dynamic Performance Tables

    D t Di ti

  • 8/11/2019 02_DB Architecture Overview.ppt

    52/58

    Data Dictionary

    The data dictionary is a set of read-only tables and

    views that record, verify, and provide information

    about its associated database.

    Describes the database and its objects

    Includes two types of objects:

    Base tables Store description of database

    Created with CREATE DATABASE

    Data Dictionary views

    Summarize base table information

    Created using catalog.sqlscript

  • 8/11/2019 02_DB Architecture Overview.ppt

    53/58

    Data Dictionary Contents

    The data dictionary provides information about:

    Logical and physical database structure

    Definitions and space allocations of objects

    Integrity constraints

    Users

    Roles

    Privileges

    Auditing

    D t Di ti Vi C t i

  • 8/11/2019 02_DB Architecture Overview.ppt

    54/58

    Data Dictionary View Categories

    The data dictionary consists of three main sets ofstatic views distinguished from each other by theirscope:

    DBA:What is in all the schemas

    ALL:What the user can accessUSER:What is in the user's schema

    DBA_xxx

    USER_xxx

    ALL_xxx

    Objects owned by the current user

    Objects accessible by the current user

    All of the objects in the database

  • 8/11/2019 02_DB Architecture Overview.ppt

    55/58

    Oracle Instance

    Oracle Database

    Database Files

    Server Processes Memory Structures

    Data Dictionary

    Schema And Users

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    56/58

    Schema Objects

    Tables

    Triggers

    Constraints

    Indexes

    Views

    Sequences

    Stored program units

    Synonyms

    User-defined data types

    Database links

    Database Schema

    A schema is a namedcollection of objects

    A user is created, and acorresponding schemacan be created

    User can be associatedonly with one schema

    Username and schemaare often used

    interchangeably Users are not

    necessarily associatedwith a schema

  • 8/11/2019 02_DB Architecture Overview.ppt

    57/58

    An Oracle server consists of an Oracle instance and

    an Oracle database

    An Oracle instance consists of several required and

    some more optional processes (threads)

    An Oracle database is built using different file types

    Oracle 11g Server Architecture

  • 8/11/2019 02_DB Architecture Overview.ppt

    58/58

    Q U E S T I O N SA N S W E R S