Oracle Architectural Components
Oracle Architectural Components
Components
Objectives
Instance
Shared Pool SGA
Library Memory
Database Redo Log
Cache
Buffer Cache Buffer structures
Data Dictionary
Cache Java Pool Large Pool
Background
PMON SMON DBWR LGWR CKPT Others
process structures
Establishing a Connection
and Creating a Session
Connecting to an Oracle Instance:
– Establishing a user connection
– Creating a session
Server
Connection process
established Session created
User Oracle Server
process
Database user
Oracle Database
An Oracle database:
– Is a collection of data that is treated as a unit
– Consists of three file types
Oracle Database
Redo
Datafiles Control Log
Parameter files files Archived
file Log files
Password
file
Physical Structure
The physical structure includes three types of
files:
– Control files
– Datafiles
– Redo log files
Header
Control
files
Datafiles
(includes
Online
Data
Redo Log
Dictionary)
files
Memory Structure
– SGA is dynamic
– Sized by the SGA_MAX_SIZE parameter
– Allocated and tracked in granules by SGA components
Contiguous virtual memory allocation
Granule size based on total estimated SGA_MAX_SIZE
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
Shared Pool
Library
Cache
Data
Dictionary
ALTER SYSTEM SET Cache
SHARED_POOL_SIZE = 64M;
Library Cache
Database Buffer
Cache
Database Buffer Cache
Server
process
User
process
Connection
established
Database user
Server Process
Database user
Background Processes
Database
Log Writer (LGWR)
Instance LGWR writes:
SGA – At commit
Redo Log
– When one-third full
Buffer
– When there is 1 MB
of redo
DBWn LGWR – Every three seconds
– Before DBWn writes
Redo
Datafiles Control Log
files files
Database
System Monitor (SMON)
Instance Responsibilities:
SGA
– Instance recovery
Rolls forward
changes in redo
logs
Opens database for
SMON user access
Rolls back
uncommitted
Redo transactions
Datafiles Control Log
files files – Coalesces free space
– Deallocates temporary
segments
Database
Process Monitor (PMON)
Instance Cleans up after
SGA
failed processes by:
– Rolling back the
transaction
– Releasing locks
PMON – Releasing other
resources
– Restarting dead
dispatchers
PGA area
Checkpoint (CKPT)
Instance Responsible for:
SGA – Signaling DBWn at
checkpoints
– Updating datafile
headers with
checkpoint information
DBWn LGWR CKPT – Updating control files
with checkpoint
information
Redo
Datafiles Control Log
files files
Database
Archiver (ARCn)
Redo ARCn
Datafiles Control Log Archived
files files Redo Log
files
Logical Structure
Extent Blocks
Tablespaces and Datafiles
– SYSTEM tablespace
Created with the database
Contains the data dictionary
Contains the SYSTEM undo segment
– Non-SYSTEM tablespace
Separate segments
Eases space administration
Controls amount of space allocated to a user
Creating Tablespaces
Causes a checkpoint
Data available only for read operations
Objects can be dropped from tablespace
Taking a Tablespace Offline
of Datafiles
– Can be resized automatically with the following
commands:
CREATE DATABASE
CREATE TABLESPACE
ALTER TABLESPACE … ADD DATAFILE
– Example:
CREATE TABLESPACE user_data
DATAFILE
'/u01/oradata/userdata01.dbf' SIZE 200M
AUTOEXTEND ON NEXT 10M MAXSIZE 500M;
– ALTER TABLESPACE
Tablespace must be offline
Target datafiles must exist
ALTER TABLESPACE userdata RENAME
DATAFILE '/u01/oradata/userdata01.dbf'
TO '/u02/oradata/userdata01.dbf';
– Steps to rename a datafile:
Take the tablespace offline.
Use an OS command to move or copy the files.
Execute the ALTER TABLESPACE RENAME
DATAFILE command.
Bring the tablespace online.
Use an OS command to delete the file if necessary.
Methods for Moving Datafiles
– ALTER DATABASE
Database must be mounted
Target datafile must exist
ALTER DATABASE RENAME
FILE '/u01/oradata/system01.dbf'
TO '/u03/oradata/system01.dbf';
Dropping Tablespaces