You are on page 1of 28

1

Oracle Architectural
Components
Objectives

•• Listing
Listing the
the structures
structures involved
involved in
in
connecting
connecting aa user
user to
to an
an Oracle
Oracle server
server
•• Listing
Listing the
the stages
stages in
in processing
processing aa query
query
•• Listing
Listing the
the stages
stages in
in processing
processing aa DML
DML
statement
statement
•• Listing
Listing the
the stages
stages in
in processing
processing
COMMITS
COMMITS

1-2
The Oracle Server
Oracle server
Application/
network
server

Server Users
1-3
Connecting to a Database
Server
Client
Client process Server
Server

User Oracle server


process

User
User

1-4
User Process

•• Runs
Runs onon the
the client
client machine
machine
•• Is
Is spawned
spawned when
when aa tool
tool or
or an
an application
application
is
is invoked
invoked
•• Runs
Runs the
the tool
tool or
or application
application (SQL*Plus,
(SQL*Plus,
Server
Server Manager,
Manager, Oracle
Oracle Enterprise
Enterprise
Manager,
Manager, Developer/2000)
Developer/2000)
•• Includes
Includes the
the User
User Program
Program Interface
Interface (UPI)
(UPI)
•• Generates
Generates calls
calls to
to the
the Oracle
Oracle server
server

1-5
Server Process

•• Runs
Runs on
on the
the server
server machine
machine (host)
(host)
•• Services
Services aa single
single user
user process
process in
in the
the
dedicated
dedicated server
server configuration
configuration
•• Uses
Uses an
an exclusive
exclusive PGA
PGA
•• Includes
Includes the
the Oracle
Oracle Program
Program Interface
Interface
(OPI)
(OPI)
•• Processes
Processes calls
calls generated
generated by
by the
the client
client
•• Returns
Returns results
results to
to the
the client
client

1-6
Oracle Instance
Instance
SGA

Background processes

An
An Oracle
Oracle instance:
instance:
•• Is
Is aa means
means to
to access
access an
an Oracle
Oracle
database
database
•• Always
Always opens
opens one
one and
and only
only one
one
database
database
1-7
Oracle Database

Control
files
Parameter
file

Password Data files Redo log Archived


file files log files

Database

1-8
Other Key Physical Structures

Parameter
file

Password Archived
file log files
Database

1-9
Processing a Query
• Parse:
- Search for identical statement
-Check syntax, object names, privileges
- Lock objects used during parse
-Create and store execution plan
• Execute: identify rows selected
• Fetch: return rows to user process

1-10
Processing a Query (cont.)
SELECT
SELECT ** Statement
FROM
FROM emp
emp Handle
ORDER
ORDER BY
BY ename;
ename;
Handle

User Server
process process

Results
OK

OK

Parse
Parse Execute
Execute Fetch
Fetch
1-11
The Shared Pool
Shared pool

Library
cache

Data
dictionary
cache

•• Size
Size defined
defined by
by SHARED_POOL_SIZE
SHARED_POOL_SIZE
•• Library
Library cache
cache contains
contains statement
statement text,
text,
parsed
parsed code,
code, and
and an
an execution
execution plan
plan
•• Data
Data dictionary
dictionary cache
cache contains
contains table
table
and
and column
column definitions
definitions and
and privileges
privileges
1-12
Database Buffer Cache

•• Number
Number of of buffers
buffers defined
defined by
by
DB_BLOCK_BUFFERS
DB_BLOCK_BUFFERS
•• Size
Size of
of aa buffer
buffer based
based on
on DB_BLOCK_SIZE
DB_BLOCK_SIZE
•• Stores
Stores the
the most
most recently
recently used
used blocks
blocks

1-13
Program Global Area (PGA)

Server PGA
process

•• Not
Not shared
shared and
and not
not writable
writable
•• Contains
Contains
–– Sort
Sort area
area
–– Session
Session information
information
–– Cursor
Cursor state
state
–– Stack
Stack space
space
1-14
Processing a DML Statement
1. If data blocks not in the buffer, server
process reads them into the buffer
2. Server process places locks on rows to
be modified
3. The redo log buffer is modified with the
changed values
4. The data blocks are changed
5. Before image is recorded in the rollback
block
1-15
Processing a DML Statement (cont.)
UPDATE
UPDATE emp
emp 3
Instance
SET
SET sal=sal*1.1
sal=sal*1.1
SGA
WHERE
WHERE empno=7369
empno=7369 4 Shared pool

Library
cache

Server 5 Database
buffer
Redo log Data
buffer dictionary
cache
process cache

Control
files
Data files Redo log
1 Database
files

1-16
Rollback Segment
Old
imag
e

New
Table imag
e
Rollback
segment

DML
statement
1-17
Redo Log Buffer

•• Size
Size defined
defined by
by LOG_BUFFER
LOG_BUFFER
•• Records
Records changes
changes made
made through
through the
the
instance
instance
•• Used
Used sequentially
sequentially
•• Circular
Circular buffer
buffer
1-18
Other Instance Processes
• Other required processes
- Database Write (DBW0)
- Log Writer (LGWR)
- Process Monitor (PMON)
- System Monitor (SMON)
- Checkpoint (CKPT)

• Archive process (ARC0) is optional; is


used in production database

1-19
Database Writer (DBWR)
Instance
SGA Shared pool
DBW0 writes
Database
when:
buffer
cache • There are many
dirty buffers
DBWR • There are few
free buffers
• Timeout occurs
• Checkpoint
occurs
Data files Control Redo log
files files

1-20
Log Writer (LGWR)
Instance
SGA Shared pool
LGWR writes
when:
Redo log
buffer • There is a commit
• The redo log buffer
LGWR is one-third full
• There is more than
1MB of redo
• Before DBW0 writes
Data files Control Redo log
files files

1-21
COMMIT Processing

1. Server process places a commit record


and system change number (SCN) in
redo log buffer.
2. LGWR writes redo log to redo log files.
3. User is informed COMMIT is complete
4. Server process records trans. Is
complete and locks can be released.

1-22
COMMIT Processing (cont.)
1 Instance
SGA Shared pool

Server Database
Redo log
buffer
process buffer
4 cache

LGWR
3
2
User
process Control
files
Data files Redo log
files
Database

1-23
SMON: System Monitor

• Automatically recovers the instance


-Rolls forward changes in redo logs
-Opens the database for user access
-Rolls back uncommitted transactions
• Coalesces free spaces
• Deallocates temporary segments

1-24
PMON: Process Monitor

Cleans up after failed processes by:


• Rolling back the transaction
• Releasing locks
• Releasing other resources

1-25
Archiving
• Database archive mode
- NOARCHIVELOG for databases that do
not require recovery after disk failure
- ARCHIVELOG mode for production
•ARC0 process
• Automatically archives online redo
log files
• Preserves the record of all changes
made to the database
1-26
Summary
Instance
SGA Shared pool

Server
process
PGA

User
DBWR LGWR
process

Parameter Control
file files
Archived
log files
Data files Redo log
Password files
file
Database

1-27
Summary (cont.)
You should have learned:
• Explain the SGA, Instance, memory
structures
• Explain the database files
• Explain the primary background processes
(DBW0, LGWR, CKPT, PMON, SMON, ARC0)
•Explain SQL processing steps
•Explain the COMMIT process

1-28

You might also like