Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 35

1

Oracle Architectural
Components

Copyright Oracle Corporation, 2001. All rights reserved.

Objectives
After completing this lesson, you should be able to
do the following:

Outline the Oracle architecture and its main


components

List the structures involved in connecting a user to


an Oracle instance

1-2

User
process

Overview of Primary
Instance
Components
Shared pool
Library
cache

Server
process

PGA

Data Dict.
cache

SGA

Redo log
Database
buffer cache buffer cache

PMON SMON DBWR LGWR

Parameter
file
Password
file

1-3

Data
files

Control
files

CKPT

Redo log
files

Database

Others

Archived
log files

Oracle Server
An Oracle server:

Is a database management
system that provides an
open, comprehensive,
integrated approach to
information management

Consists of an Oracle

instance and an Oracle


database

1-4

Oracle Server

Oracle Instance
An Oracle instance:

Is a means to access an Oracle database


Always opens one and only one database
Consists of memory and process structures
Instance
Shared pool
Library
cache
Data Dictionary
cache

SGA
Redo log
Database
buffer cache buffer cache

PMON SMON DBWR LGWR CKPT Others

1-5

Memory
structures

Background
structures

Establishing a Connection
and Creating a Session
Connecting to an Oracle instance consists of
establishing a user connection and creating a
session.
Connection
established
User
process

Database user

1-6

Server
process
Session created
Oracle server

Oracle Database
An Oracle database:

Is a collection of data that is treated as a unit


Consists of three file types
Oracle Database
Parameter
file
Password
file

1-7

Data
files

Control
files

Redo
log files

Archived
log files

Physical Structure
The physical structure of an Oracle database is
determined by the operating system files that
provide the actual physical storage for database
information.
Control files
Header
Data files
Control
files
Redo log files
Online
redo log
files)

1-8

Data files
(includes
data
dictionary)

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

1-9

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)

There are two optional memory structures that can


be configured within the SGA:

1-10

Large pool

Java pool

System Global Area (SGA)


SGA is dynamic and sized using SGA_MAX_SIZE.
SGA memory allocated and tracked in granules by
SGA components

1-11

Contiguous virtual memory allocation

Size based on SGA_MAX_SIZE

Shared Pool
The shared pool is used to store the most recently
executed SQL statements and the most recently used
data definitions.

It consists of two key performance-related memory


structures:

Library cache

Data dictionary cache

Sized by the parameter


SHARED_POOL_SIZE.
ALTER SYSTEM SET
SHARED_POOL_SIZE = 64M;

1-12

Shared pool
Library
cache
Data dictionary
cache

Library Cache
The library cache stores information about the most
recently used SQL and PL/SQL statements. The
library cache:

Enables the sharing of commonly used statements

Consists of two structures:

1-13

Is managed by a least recently used (LRU)


algorithm

Shared SQL area

Shared PL/SQL area

Has its size determined by the shared pool sizing

Data Dictionary Cache


The data dictionary cache is a collection of the most
recently used definitions in the database.

It includes information about database files, tables,


indexes, columns, users, privileges, and other
database objects.

During the parse phase, the server process looks


at the data dictionary for information to resolve
object names and validate access.

Caching the data dictionary information into

memory improves response time on queries.

Size is determined by the shared pool sizing.


1-14

Database Buffer Cache


The database buffer cache stores copies of data
blocks that have been retrieved from the data files.

1-15

It enables great performance gains when you


obtain and update data.

It is managed through a least recently used (LRU)


algorithm.

DB_BLOCK_SIZE
determines the
primary block size.

Database buffer
cache

Database Buffer Cache

Consists of independent sub-caches:


DB_CACHE_SIZE
DB_KEEP_CACHE_SIZE
DB_RECYCLE_CACHE_SIZE

Database buffer cache can be dynamically resized


to grow or shrink using ALTER SYSTEM.
ALTER SYSTEM SET DB_CACHE_SIZE = 96M;

1-16

DB_CACHE_ADVICE can be set to gather statistics


for predicting different cache size behavior.

Redo Log Buffer Cache


The redo log buffer cache records all changes
made to the database data blocks.

1-18

Its primary purpose is recovery.

Size is defined by
LOG_BUFFER.

Changes recorded within are called redo entries.


Redo entries contain information to reconstruct
or redo changes.
Redo log
buffer cache

Large Pool
The large pool is an optional area of memory in the
SGA configured only in a shared server environment.

It relieves the burden placed on the shared pool.


This configured memory area is used for session

memory (UGA), I/O slaves, and backup and restore


operations.

Unlike the shared pool, the large pool does not use
an LRU list.

Sized by LARGE_POOL_SIZE.
ALTER SYSTEM SET LARGE_POOL_SIZE = 64M;

1-19

Java Pool
The Java pool services the parsing requirements for
Java commands.

Required if installing and using Java.


It is stored much the same way as PL/SQL in
database tables.

It is sized by the JAVA_POOL_SIZE parameter.

1-20

Program Global Area (PGA)


The PGA is memory reserved for each user process
that connects to an Oracle database.
PGA
Server
process

Dedicated server
Session

information
Stack
space sort area, cursor
information

User
process

SGA

Stack sort area, cursor


information
space

SGA
Session
information

Shared SQL areas


1-21

Shared server

Shared SQL areas

Process Structure
An Oracle process is a program that depending on its
type can request information, execute a series of
steps, or perform a specific task.
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 started when a user establishes a session.

Background process: Available when an Oracle


instance is started

1-22

User Process
A user process is a program that requests interaction
with the Oracle server.

It must first establish a connection.


It does not interact directly with the Oracle server.

User
process

Server
process
Connection
established

Database user
1-23

Server Process
A server process is a program that directly interacts
with the Oracle server.
It fulfills calls generated and returns results.
Can be dedicated or shared server.

Connection
established

User
process

Database user
1-24

Server
process
Session created

Oracle server

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

RECO

Optional background processes


ARCn

LMON

QMNn LMDn

1-25

CJQ0

Pnnn

LCKn

Dnnn

Snnn

Database Writer (DBWn)


Instance

DBWn writes when:

SGA

Checkpoint
Dirty buffers threshold

Database

reached

buffer
cache
DBWn

Data
files

Control
files

Database

Redo log
files

No free buffers
Timeout
RAC ping request
Tablespace offline
Tablespace read only
Table DROP or
TRUNCATE

Tablespace BEGIN
BACKUP

1-26

Log Writer (LGWR)


Instance
SGA

LGWR writes:
Redo log
buffer

DBWn LGWR

At commit
When one-third full
When there is 1 MB
of redo

Every 3 seconds
Before DBWn
writes

Data
files

Control
files

Database

1-27

Redo log
files

System Monitor (SMON)


Instance
SGA

Responsibilities:

Instance recovery:

SMON

Data
files

Control
files

Database

1-28

Redo log
files

Rolls forward
changes in the
redo logs
Opens the
database for
user access
Rolls back
uncommitted
transactions
Coalesces free
space ever 3 sec
Deallocates
temporary segments

Process Monitor (PMON)


Instance
SGA

Cleans up after
failed processes by:

Rolling back the


transaction

Releasing locks
Releasing other

PMON

resources

Restarts dead
PGA area

1-29

dispatchers

Checkpoint (CKPT)
Instance
SGA

Responsible for:
Redo Log

Signalling DBWn
at checkpoints

Buffer

Updating datafile
DBWn LGWR
DWW0

Data
files

1-30

headers with
checkpoint
information

CKPT

Control
files

Redo log
files

Updating control
files with
checkpoint
information

Archiver (ARCn)
Optional background process
Automatically archives online redo logs when
ARCHIVELOG mode is set

Preserves the record of all changes made to the


database

Data
files

1-31

Control
files

Redo log
files

ARCn
ARCn

Archived
Redo log
files

Logical Structure
The logical structure of the Oracle architecture
dictates 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

Extent

1-32

Segment

Blocks

Processing a SQL Statement


Connect to an instance using:

The user process

The server process

The Oracle server components that are used


depend on the type of SQL statement:

Queries return rows.

DML statements log changes.

Commit ensures transaction recovery.

Some Oracle server components do not participate


in SQL statement processing.

1-33

Processing a SELECT Statement

1-34

Search Shared Pool


Validate statement
Validate data source
Acquire locks
Check privileges
Parse statement
Execute statement
Fetch values from cursor

Processing a DML Statement


Prase statement
Execute Statement

1-35

Read data from data and undo segment into buffer


cache

Lock data and undo segment

Records the before image to the undo block and


updates the data block

Any changed blocks in the buffer cache are marked


as dirty buffers

Generate redo information

Summary
In this lesson, you should have learned how to:

Explain database files: data files, control files,


online redo logs

Explain SGA memory structures: Database buffer


cache, shared SQL pool, and redo log buffer

Explain primary background processes:

DBWn, LGWR, CKPT, PMON, SMON, and ARCn

1-36

You might also like