Basic Oracle Architecture: Presented To HIOUG
Basic Oracle Architecture: Presented To HIOUG
Basic Oracle Architecture: Presented To HIOUG
Presented to HIOUG
21-Jun-2005
By Byron Bush
Workshop Objectives
Identify high-level architectural components of an
Oracle Database
Describe the function of each of these components
Identify Oracle Database internal data structures
Define the mechanisms used when processing
Insert/Update/Delete statements
Most people call it a “Database”
Technically an Oracle Database is broken into two high-
level components
Instance
Database
Oracle RAC is Different
Oracle “Real Application Clusters” allow multiple
“Instances” to interact with a single “Database” to
provide high availability…
Database
“Instance” a Little Closer
An Oracle Instance…
Is a means to access an Oracle Database
Always opens one and only one Database
Consists of memory and background process structures
Picture of an “Instance”
Instance
SGA
Shared Pool
Back-
PMON SMON DBWR LGWR CKPT Others Ground
Processes
“Database” a Little Closer
An Oracle Database…
Is a collection of data that is treated as a unit
Consists of three file types
Picture of a “Database”
Oracle Database
Parameter Archived
File Log Files
Password
File
Picture of an “Instance”
Instance
SGA
Shared Pool
Back-
PMON SMON DBWR LGWR CKPT Others Ground
Processes
Memory Structure
Oracle’s memory structure consists of two memory areas
known as:
1. System Global Area (SGA): Allocated at instance
start up, and is a fundamental component of an
Oracle Instance
2. Program Global Area (PGA): Allocated when the
server process is started
System Global Area
The SGA consists of several memory structures:
Shared Pool
Database Buffer Cache
Redo Log Buffer
Other structures
There are two additional memory structures that
can be configured within the SGA:
Large Pool
Java Pool
System Global Area
The size of the SGA is determined by the parameters
that set the sizes of the various pools; these parameters
are dynamic
The SGA_MAX_SIZE parameter sets the maximum
size of the SGA (so you can limit it) and is not a
dynamic parameter
Thanks Ned!
Picture of an “Instance”
Instance
SGA
Shared Pool
Back-
PMON SMON DBWR LGWR CKPT Others Ground
Processes
Shared Pool
Used to store:
Most recently executed SQL statements
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
Library Cache
Stores information about the most recently used
SQL and PL/SQL statements
Enables the sharing of commonly used statements
Is managed by a least recently used (LRU)
algorithm
Consists of two structures
Shared SQL area
Shared PL/SQL area
Size is determined by the Shared Pool sizing
Picture of an “Instance”
Instance
SGA
Shared Pool
Back-
PMON SMON DBWR LGWR CKPT Others Ground
Processes
Data Dictionary Cache
A collection of the most recently used definitions in
the database
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
Database Buffer Cache
Stores copies of data blocks that have been retrieved
from the data files
Enables great performance gains when you obtain and
update data
Managed through an LRU algorithm
DB_BLOCK_SIZE determines primary block size
Picture of an “Instance”
Instance
SGA
Shared Pool
Back-
PMON SMON DBWR LGWR CKPT Others Ground
Processes
Redo Log Buffer
Records all changes made to the database data blocks
Primary purpose is recovery
Changes recorded within are called redo entries
Redo entries contain information to reconstruct or redo
changes
Size defined by LOG_BUFFER
Large Pool
An optional area of memory in the SGA
Relieves the burden place on the Shared Pool
Used for:
Session memory for the Shared Server
I/O server processes
Backup and restore operations for RMAN
Does not use an LRU list
Sized by LARGE_POOL_SIZE
Can be dynamically resized
Java Pool
Services parsing requirements for Java commands
Required if installing and using Java
Sized by JAVA_POOL_SIZE parameter
Oracle “Process” Structure
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 Processes: Started when an Oracle instance
is started
User Process
A program that requests interaction with the Oracle
server
Must first establish a connection
Does not interact directly with the Oracle server
User Server
Process Process
Connection
Established
Server Process
A program that directly interacts with the Oracle server
Fulfills calls generated and returns results
Can be dedicated or shared server
Picture of an “Instance”
Instance
SGA
Shared Pool
Back-
PMON SMON DBWR LGWR CKPT Others Ground
Processes
Background Processes
Maintains and enforces relationships between physical
and memory structures
Mandatory background processes:
DBWn PMON CKPT
LGWR SMON
Optional background processes:
ARCn LMDn QMNn
CJQ0 LMON RECO
Dnnn LMS Snnn
LCKn Pnnn
Database Writer (DBWn)
Instance
Oracle TRUNCATE
Database
Control Files Redo Log Files Tablespace BEGIN
Data Files
BACKUP
Log Writer (LGWR)
Instance
Oracle
Database
Control Files Redo Log Files
Data Files
System Monitor (SMON)
Instance
Shared Responsibilities:
Shared Pool
Pool SGA
Instance recovery
Library Database Buffer Redo Log
Cache Buffer Rolls forward changes in
Cache
online redo log files
Data
Dictionary Opens database for user
Java Pool Large Pool
Cache access
Rolls back uncommitted
Data transaction
Dictionary Java Pool Large Pool Releasing locks
Cache
Releasing other resources
Restarting dead
PMON SMON DBWR LGWR CKPT Others
dispactchers
Oracle
Database
Control Files Redo Log Files
Data Files
Checkpoint (CKPT)
Instance
Oracle
Database
Control Files Redo Log Files
Data Files
Archiver (ARCn)
Optional background process
Automatically archives online redo log files when
ARCHIVELOG mode is set
Preserves the record of all changes made to the
database
Oracle
Database
Control Files Redo Log Files Archived Logs
Data Files
ARCn
Oracle Data Storage
Oracle keeps all system and user data in two basic
storage containers:
1. Tablespace… a logical entity known only to Oracle
2. Data Files… physical files that may (typically) be
seen from the operating system
Tablespaces
Can belong to only one database at a time
Consist of one or more data files
Are further divided into logical units of store
Data Files
Can belong to only one tablespace and one database
Are a repository for schema object data
Database
Tablespace
Data Data
File File
2 Types of Tablespace
1. Tablespaces required by Oracle for normal
operations
2. Tablespaces that contain data and indexes that
support your applications
Required Tablespaces
System – Contains the Oracle Data Dictionary
Sysaux - New to 10g; supports historic monitoring /
tuning
Temporary – Used for disk-based sorting of data
(select...from…order by)
Undo – Used for transaction consistency during
Insert / Update / Delete statements
SQL Statements (IUDS)
Insert
What happens when
Update
someone connects to
Delete
the database and
Select
issues one of these
statements?
Connect to Oracle – What Happens
User Server
Process Process
Connect User/Pwd
Oracle
Database
Control Files Redo Log Files Archived Logs
Data Files
ARCn
Summary
What we called a “Database” is really an “Instance”
and a “Database.”
An Oracle “Instance” is not persistent. It consists of
the System Global Area (SGA) and a collection of
processes.
An Oracle “Database” is persistent. It consists of a
collection of “Required” and “User” tablespaces (with
corresponding data files) along with other supporting
files.
Nearly every component of the “Instance” and
“Database” are mobilized to execute SQL statements.