0% found this document useful (0 votes)
113 views61 pages

Explorando La Arquitectura de La Base de Datos Oracle

The Oracle database architecture includes database processes that manage memory structures like the system global area (SGA) and process global area (PGA), as well as background processes that perform tasks like checkpointing and archiving. The SGA contains shared components like the buffer cache, redo log, and shared pool that are used by server processes to service requests from user processes representing database clients or applications. Server processes manage sessions between user processes and the database instance through connections.

Uploaded by

Michaell Fajardo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views61 pages

Explorando La Arquitectura de La Base de Datos Oracle

The Oracle database architecture includes database processes that manage memory structures like the system global area (SGA) and process global area (PGA), as well as background processes that perform tasks like checkpointing and archiving. The SGA contains shared components like the buffer cache, redo log, and shared pool that are used by server processes to service requests from user processes representing database clients or applications. Server processes manage sessions between user processes and the database instance through connections.

Uploaded by

Michaell Fajardo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Presentación

o Ingeniero de Sistemas – USB Cali


o Especialización en Gerencia de Proyectos – IEP – UniAsturias
o Máster en Administración y Dirección de Empresas – EUDE – U. Rey Juan
Carlos, Madrid - España
o 20+ años de Experiencia Laboral
o 4+ años en docencia
o Actualidad: Software Engineer en Encora – Docente H.C. UniCamacho
Excel

2
Presentación y Logística
• Nombre • Horario
• Objetivos al tomar el curso • Instalaciones
• Qué sabe de Oracle • Recesos
• Normas para dispositivos de
comunicación móvil y PDAs.
• Material
Diseño y Optimización Bases
de Datos
Modulo 2: Oracle

Exploring the Oracle Database


Architecture
Objetivos
– Conocer los principales componentes de la Arquitectura
de Oracle Database Server

– Explicar estructuras de memoria

– Conocer los procesos en Segundo plano

– Estructuras de almacenamiento lógico y físico


Oracle Database
• The Oracle relational database management
system (RDBMS) provides an open,
comprehensive, integrated approach to
information management
Connecting to a Server

Client Middle tier Server

Multitier architecture shown


Instance-Database Configurations

Nonclustered system Clustered system

I1
I1 I2 I3
I2

D1

D2

Local storage
D

Shared storage
Oracle Database Server Architecture:
Overview
Instance

SGA

BGP1 BGP2 BGP3 BGPn

Database
Oracle Database Server Architecture
Overview
Instance
PGA
Server
process Memory structures
(System Global Area)

Server
Connection Process structures

User
process

Session Client Database (storage structures)


Quiz

• Son componentes de la arquitectura de Base de


Datos Oracle:
Respuesta
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
Connecting to the Database Instance
User
– Connection: Bidirectional network process

pathway between a user process


on a client or middle tier and an User
process
Oracle process on the server
– Session: Representation of Shared
Dispatcher Server
a specific login by a user Listener
process D000 S000

Connection

User Server SGA


SQL> Select … process process
Dedicated
User Server Server host

Session (Specific connected database user)


Oracle Database Memory Structures:
Overview
SGA

Database buffer Redo log Shared pool Large pool


cache buffer

Java pool Streams


pool

Server
process
Server
process
… Background
process

…Aggregated
PGA

Database Buffer Cache
– Is a part of the SGA
– Holds copies of data blocks that are read from data files
– Is shared by all concurrent processes
SGA

Server
Database
process
buffer
cache

DBWn

Database writer
Data files process
Redo Log Buffer
– Is a circular buffer in the SGA (based on the number of
CPUs)
– Contains redo entries that have the information to redo
changes made by operations, such as DML and DDL
SGA

Server
process Redo log
buffer

LGWR

Log writer process


Redo log
files
Shared Pool

– Is part of the SGA


– Contains: Server
process
• Library cache
– Shared parts of SQL and
PL/SQL statements
• Data dictionary cache SGA

• Result cache:
– SQL queries
Data
– PL/SQL functions dictionary Result
cache
• Control structures Library cache
cache (row cache)
– Locks
Control structures

Shared pool
Processing a DML Statement: Example
Database
DBWn SGA

Database
2 4
2 buffer cache
Data Server Redo log
files process 3 buffer

Shared pool
5
Control 1 Library cache
files
User
process

Redo
log files
COMMIT Processing: Example
Database
DBWn SGA

Database
buffer cache
Data Server Redo log
files process 1 SGA
buffer

Shared pool
3
Control Library cache
files
User
process

Redo
log files LGWR 2
Quiz

• La primera vez que un proceso requiere una


determinada información, la busca en:
Respuesta
Large Pool

– Optional pool better suited


when using the following:
• Parallel execution
• Recovery Manager (backup Server
and restore operations) process

• Shared server
SGA

Free
I/O buffer
memory
Response Request
queue queue
Large pool
Java Pool and Streams Pool

– Java pool memory is used in server memory for all


session-specific Java code and data in the JVM.
– Streams pool memory is used exclusively by
Oracle Streams to:
• Store buffered queue messages
• Provide memory for Oracle Streams processes
• Replicación de objetos y datos

Java pool Streams pool


Program Global Area (PGA)
– PGA is a memory area that contains: Server
• Session information process
• Cursor information
• SQL execution work areas:
– Sort area
– Hash join area
– Bitmap merge area Stack
User Global Area (UGA)
User
– Bitmap create area Space Session Cursor
Status
SQL
Area
Data
– Work area size influences SQL performance.
– Work areas can be automatically or manually
managed.
Background Process Roles
RCBG MMON CJQ0 QMNn MMAN

Database
SGA Redo log
buffer Shared pool
buffer
cache

CKPT PMON SMON DBWn LGWR ARCn


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
Process Structures
Instances (ASM and Database separate)

System Global Area (SGA)


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

Optional: ARCn ASMB RBAL Others


Listener

Grid Infrastructure Processes


(ASM and Oracle Restart)
User ohas ocssd diskmon
process

orarootagent oraagent cssdagent


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
Log Writer Process (LGWR)
– Writes the redo log buffer to a redo log file on disk
– Writes:
• When a user process commits a transaction
• When the redo log buffer is one-third full
• Before a DBWn process writes modified buffers to disk
• Every 3 seconds

LGWR

Redo log buffer Log Writer process Redo log files


Checkpoint Process (CKPT)

– Records checkpoint information in


• Control file
• Each data file header

CKPT Control file

Checkpoint
process

Data files
Quiz
• Región de memoria que contiene datos e
información de control para un proceso en segundo
plano:
Respuesta
System Monitor Process (SMON)

– Performs recovery at instance startup


– Cleans up unused temporary segments

Instance
SMON

System Monitor
process

Temporary
segment
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
– Dynamically registers database services with
listeners
Server
process

PMON
User
tnslsnr Database buffer
Failed user process Process Monitor
process cache
Recoverer Process
– 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
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
Process Startup Sequence
– Oracle Grid Infrastructure is started by the OS init
daemon.
Operating System Grid Infrastructure Grid Infrastructure
Init Daemon Wrapper Script Daemons and Processes
init ohasd.bin
init.ohasd oraagent.bin ASM Instance
(root) Listener
orarootagent.bin
DB Instance
diskmon.bin User Defined
cssdagent Applications
ocssd.bin

– Oracle Grid Infrastructure installation modifies the


/etc/inittab file to ensure startup every time
machine is started in corresponding run level.
# cat /etc/inittab
..
h1:35:respawn:/etc/init.d/init.ohasd run >/dev/null 2>&1 </dev/null
Automatic Shared Memory
Management
SGA_TARGET + STATISTICS_LEVEL
SGA

Shared pool Fixed SGA Large pool

Java Streams Database Redo log


pool pool buffer cache buffer

Which size to choose?

Automatically tuned SGA components


Automated SQL Execution Memory
Management
PGA_AGGREGATE_TARGET

Server
process
Server
process
… Background
process

…Aggregated
PGA

Which size to choose?


Quiz

• Sobre que componentes, ASMM ajusta el tamaño a


medida que cambia la carga de trabajo:
Respuesta
Automatic Memory Management
– Sizing of each memory component is vital for SQL
execution performance.
– It is difficult to manually size each component.
– Automatic memory management automates memory
allocation of each SGA component and aggregated PGA.
MMAN
Streams pool

Buffer cache
Shared pool
Other SGA

Large pool

Untunable
SQL areas
Java pool

Private

Free

PGA
MEMORY_TARGET + STATISTICS_LEVEL
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


Logical and Physical Database
Structures
Logical Physical

Database

Only 1 with
bigfile
tablespaces
Schema Tablespace Data file
0, 1, or many

Undo tablespaces
never have 0 Segment

Extent

Oracle data
OS block
block
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
Tablespaces and Data Files
Tablespace 1 Tablespace 2 (Bigfile)

Datafile 1 Datafile 2 Datafile 3

8Kb 8Kb 8Kb 8Kb 8Kb


8Kb 8Kb 8Kb 8Kb 8Kb
Only 1 datafile
8Kb 8Kb 8Kb 8Kb 8Kb allowed
8Kb 8Kb 8Kb 8Kb 8Kb <= 128 TB

Extent Extent
64KB 96KB

Segment
160KB
Quiz
• Que es leído desde los data files hacia el
Database Buffer Cache:
Respuesta
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 (such as the Enterprise Manager
Repository).
– The SYSTEM and SYSAUX tablespaces are not
recommended to be used to store application's data.
Automatic Storage Management
– Is a portable and high-performance
cluster file system
– Manages Oracle database files Oracle
Application
– Manages application files with Database

ASM Cluster File System (ACFS)


– Spreads data across disks ASM Cluster
to balance load File ASM Files
System
– Mirrors data in case of failures for Oracle
Database
ASM Dynamic
– Solves storage-management Volume
challenges Manager
Automatic Storage Management

Operating system
ASM Storage Components
ASM

Oracle
ASM
Database ASM file
disk group
datafile

ASM
extent

File system
or ASM allocation
Raw device ASM disk
unit
Interacting with an Oracle Database:
Memory, Processes and Storage
Instance

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

User
process

User
Quiz
• ¿A qué tipo de instancias se accede a los
archivos ASM?
Respuesta
Quiz
• Process Monitor process (PMON):
Respuesta
Practice 1: Overview
• This is a paper practice with questions about:
– Database architecture
– Memory
– Processes
– File structures
Resumen
– Cuales los principales componentes de la
Arquitectura de Oracle Database Server ?

– Cuales son las estructuras de memoria?

– Que hacen los procesos en Segundo plano ?

– Cuales son las Estructuras de almacenamiento


lógico y físico?
Video
Repaso Final
Muchas Gracias!

You might also like