Sei sulla pagina 1di 39

Exploring the Oracle Database Architecture

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Objectives

After completing this lesson, you should be able to:


• List the major architectural components of Oracle
Database
• Explain memory structures
• Describe background processes
• Correlate logical and physical storage structures
• Describe pluggable databases
• Describe ASM storage components

2-2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Database Server Architecture: Overview

Instance
PGA
Server
process Memory Structures
(System Global Area)

Server
Process Structures

User
process

Database (Storage Structures)


Client

2-3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Database Instance Configurations

Nonclustered System Clustered System

I1
I1 I2 I3
I2

D1

D2

Local Storage D

Shared Storage

2-4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Connecting to the Database Instance

• Connection: Communication between a user process and


an instance
• Session: Specific connection of a user to an instance
through a user process

User Server
SQL> Select … process process
User
Session

Connection

Session

2-5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Database Memory Structures

Program Global Area (PGA) PGA


Stack User Stack User
Space Global Space Global
Area Area
Server Server
process 1 process 2

Database
Redo log
Shared pool buffer
buffer
cache

Java pool Streams


Large pool Fixed SGA
pool

System Global Area (SGA)

2-6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Shared Pool

• Is a portion of the SGA


• Contains:
Data Dictionary
– Library cache Shared Cache
SQL Area
— Shared SQL area Server Result
Cache
– Data dictionary cache
– Server result cache Other

Library
Cache Reserved Pool
Database
Redo log
Shared pool buffer
buffer
cache

Java pool Streams


Large pool Fixed SGA
pool

System Global Area (SGA)

2-8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
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

Keep pool

Recycle Database
pool Redo log
Shared pool buffer
buffer
cache
nK buffer
cache

Java pool Streams


Large pool Fixed SGA
pool

System Global Area (SGA)

2 - 10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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 redo
changes made by operations such as DML and DDL

Database
Redo log
Shared pool buffer
buffer
cache

Redo log Java pool Streams


Large pool Fixed SGA
buffer pool

System Global Area (SGA)

2 - 11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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

Redo log
Database
buffer
Shared pool buffer
cache Free Parallel
I/O buffer
RECYCLE memory
Query
buffer pool
Response Request Advanced
Streams queue
Large pool Java pool Fixed SGA queue Queuing
pool
Large pool
System Global Area (SGA)

2 - 12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Java Pool

Java pool memory is used to store all session-specific Java


code and data in the JVM.

Database Redo log


Shared pool buffer buffer
cache

Java pool Streams


Large pool Fixed SGA
pool

Java pool System Global Area (SGA)

2 - 13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Streams Pool

Streams pool memory is used exclusively by Oracle Streams


to:
• Store buffered queue messages
• Provide memory for Oracle Streams processes

Database Redo log


Shared pool buffer buffer
cache

Java pool Streams nK buffer


Large pool pool cache

System Global Area (SGA) Streams pool

2 - 14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Program Global Area (PGA)

PGA Cursor Sort Hash


Area Area
State
Stack User
Create Bitmap Area
Space Global User Session
Area Data Bitmap Merge Area
Server
process 1
SQL
Work Areas

Database
Redo log
Shared pool buffer buffer
cache

Java pool Streams


Large pool Fixed SGA
pool

System Global Area (SGA)

2 - 15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Quiz

The memory region that contains data and control information


for a server or background process is called:
a. Shared pool
b. PGA
c. Buffer cache
d. User session data

2 - 16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Quiz

What is read into the database buffer cache from data files?
a. Rows
b. Changes
c. Blocks
d. SQL

2 - 17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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 instance
is started
• Daemon / Application processes
– Networking listeners
– Grid Infrastructure daemons

2 - 18 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Process Structures

Instances (ASM and Database separate)

System Global Area (SGA)


PGA
Server Background processes
process
Required: DBWn CKPT LGWR SMON PMON

RECO LREG MMON MMNL Others


Listener
Optional: ARCn Others

Grid Infrastructure Processes


(ASM and Oracle Restart)
User ohas ocssd diskmon
process

orarootagent oraagent cssdagent

2 - 20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Database Writer Process (DBWn)

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


disk:
• Asynchronously while performing other processing
• To advance the checkpoint

DBWn

Database buffer Database Writer Data files


cache process

2 - 22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Log Writer Process (LGWR)

• Writes the redo log buffer to a redo log file on disk


– When a user process commits a transaction
– When an online redo log switch occurs
– When the redo log buffer is one-third full or contains 1 MB of
buffered data
– Before a DBWn process writes modified buffers to disk
– When three seconds have passed since the last write
• Serves as coordinator of LGnn processes and ensures
correct order for operations that must be ordered

LGWR
Redo log
buffer
LGnn

LGnn Redo log files

2 - 24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Checkpoint Process (CKPT)

• Records checkpoint information in


– Control file
– Each data file header
• Signals DBWn to write blocks to disk

CKPT Control file

Checkpoint
process

Data files

2 - 26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


System Monitor Process (SMON)

• Performs recovery at instance startup


• Cleans up unused temporary segments

Instance
SMON

System Monitor
process

Temporary
segment

2 - 27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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

Server
process

PMON
User
Database buffer
Failed user process Process Monitor
cache
process

2 - 28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Recoverer Process (RECO)

• 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

RECO

Recoverer process In-doubt transaction


in database A in database B

2 - 29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Listener Registration Process (LREG)

Registers information about the database instance and


dispatcher processes with the Oracle Net Listener

Instance

Memory Structures
(System Global Area)

Process Structures
LREG listener

2 - 30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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 to
standby destinations

ARCn

Archiver process Copies of redo log Archive destination


files

2 - 31 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Database Storage Architecture

Control files Data files Online redo log files

Parameter file Backup files Archived redo log


files

Password file Alert log and trace files

2 - 32 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Logical and Physical Database Structures

Logical Physical

Database

Tablespace Data file

Segment
Storage System
• SAN • NFS
Extent
• NAS • ASM
• Exadata
Oracle data
• File System
block

2 - 34 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


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 Data Disk blocks


blocks (File System
Storage)

2 - 36 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tablespaces and Data Files

Tablespace 1 Tablespace 2 (Bigfile)

Data file 1 Data file 2 Data file 3

8Kb 8Kb 8Kb 8Kb

8Kb 8Kb 8Kb 8Kb


Only 1 data file
8Kb 8Kb 8Kb 8Kb allowed
8Kb 8Kb 8Kb 8Kb <= 128 TB

Extent Extent
64 KB 64 KB

Segment
128 KB

2 - 37 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


SYSTEM and 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.
• The SYSTEM and SYSAUX tablespaces should not be used
for application data.

2 - 38 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Container Database: Introduction

• Pluggable database: Is a set of database schemas that


appears logically to users and applications as a separate
database
• Multitenant container database: Has a database instance
and database files at the physical level
• All pluggable databases share:
– Background processes
– Shared/process memory
– Oracle metadata

2 - 39 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Multitenant Architecture
Instance
Server System Global Area
PDBid2 PDBid3 PDBid4 PDBid2 PDBid4
Instance
Process Structures

Multitenant
container
database Data files Control files Redo Log files
UNDO
SYSTEM

All PDBs share: TEMP


SYSAUX
• Background
processes root container
• Shared/process
memory Data files Data files Data files
• Oracle metadata SYSTEM SYSTEM
• Redo log files TEMPO TEMP2
• Control files SYSAUX SYSAUX TBS2
• Undo tablespace Seed PDB SALES PDB HR PDB

2 - 40 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Automatic Storage Management

• Is a portable and high-performance


cluster file system
• Manages Oracle database files Oracle
Application Database
• Manages application files with
ASM Cluster File System (ACFS)
• Spreads data across disks ASM Cluster
File
to balance load ASM Files
System for Oracle
• Mirrors data in case of failures Database
ASM Dynamic
• Solves storage management Volume
challenges Manager
Automatic Storage Management

Operating system

2 - 41 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


ASM Storage Components

ASM

Oracle
ASM
Database ASM file
disk group
Data file

ASM
extent

File system ASM allocation


ASM disk
unit

2 - 42 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Interacting with an Oracle Database:
Memory, Processes, and Storage
Instance

Database
Redo log
Shared pool buffer
PGA buffer
cache
Server
process
Java pool Streams
Large pool Fixed SGA
pool
Listener
DBWn CKPT LGWR SMON PMON RECO ARCn Others

User
process

User

2 - 43 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Quiz

The Process Monitor process (PMON):


a. Performs recovery at instance startup
b. Performs process recovery when a user process fails
c. Automatically resolves all in-doubt transactions
d. Writes the redo log buffer to a redo log file

2 - 45 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Quiz

ASM files are accessed by which types of instances?


a. RDBMS instances only
b. ASM instances only
c. Both RDBMS and ASM instances

2 - 46 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Summary

In this lesson, you should have learned how to:


• List the major architectural components of Oracle
Database
• Explain memory structures
• Describe background processes
• Correlate logical and physical storage structures
• Describe pluggable databases
• Describe ASM storage components

2 - 47 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Practice 2

• 2-1: Exploring the Oracle Database Architecture


• 2-2: Listing Existing Instances and Oracle Homes
• 2-3: Determining the Locations of Data Files, Control Files
and Redo Log Files
• 2-4: Determining the Character Set of Existing Database(s)
• 2-5: Determining Existing Listeners

2 - 48 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Potrebbero piacerti anche