Professional Documents
Culture Documents
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
So Why Differentiate?
Most Oracle installations consist of only a single Instance and single Database
Instance
Database
Database
Picture of an Instance
Instance Shared Pool Library Cache Data Dictionary Cache SGA Database Buffer Cache Redo Log Buffer
Memory Structures
Java Pool
Large Pool
PMON
SMON
DBWR
LGWR
CKPT
Others
BackGround Processes
Picture of a Database
Oracle Database Data Files
Parameter File Password File
Control Files
Picture of an Instance
Instance Shared Pool Library Cache Data Dictionary Cache SGA Database Buffer Cache Redo Log Buffer
Memory Structures
Java Pool
Large Pool
PMON
SMON
DBWR
LGWR
CKPT
Others
BackGround Processes
Memory Structure
Oracles memory structure consists of two memory areas known as: 2. System Global Area (SGA): Allocated at instance start up, and is a fundamental component of an Oracle Instance 3. Program Global Area (PGA): Allocated when the server process is started
There are two additional memory structures that can be configured within the SGA:
Large Pool Java Pool
Thanks Ned!
Picture of an Instance
Instance Shared Pool Library Cache Data Dictionary Cache SGA Database Buffer Cache Redo Log Buffer
Memory Structures
Java Pool
Large Pool
PMON
SMON
DBWR
LGWR
CKPT
Others
BackGround Processes
Shared Pool
Used to store:
Most recently executed SQL statements Most recently used data definitions
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
Picture of an Instance
Instance Shared Pool Library Cache Data Dictionary Cache SGA Database Buffer Cache Redo Log Buffer
Memory Structures
Java Pool
Large Pool
PMON
SMON
DBWR
LGWR
CKPT
Others
BackGround Processes
Picture of an Instance
Instance Shared Pool Library Cache Data Dictionary Cache SGA Database Buffer Cache Redo Log Buffer
Memory Structures
Java Pool
Large Pool
PMON
SMON
DBWR
LGWR
CKPT
Others
BackGround Processes
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
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 Process Server 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 Shared Pool Library Cache Data Dictionary Cache SGA Database Buffer Cache Redo Log Buffer
Memory Structures
Java Pool
Large Pool
PMON
SMON
DBWR
LGWR
CKPT
Others
BackGround Processes
Background Processes
Maintains and enforces relationships between physical and memory structures
Mandatory background processes:
DBWn LGWR ARCn CJQ0 Dnnn LCKn PMON SMON LMDn LMON LMS Pnnn CKPT
DBWR
LGWR
CKPT
Others
Data Files
Checkpoint occurs Dirty buffers reach threshold There are no free buffers Timeout occurs Tablespace OFFLINE Tablespace READ ONLY Table DROP or TRUNCATE Tablespace BEGIN BACKUP
LGWR writes:
At commit When one-third full When there is 1 MB of redo Every three seconds Before DBWn writes
DBWR
LGWR
CKPT
Others
Data Files
Responsibilities:
Instance recovery
Rolls forward changes in online redo log files Opens database for user access Rolls back uncommitted transactions
DBWR
LGWR
CKPT
Others
Data Files
Redo Log Files
DBWR
LGWR
CKPT
Others
Data Files
Checkpoint (CKPT)
Instance Shared Pool Shared Pool Library Cache Data Dictionary Cache PMON SMON SGA Database Buffer Cache Java Pool Redo Log Buffer Large Pool
Responsible for:
Signaling DBWn at checkpoints Updating datafile headers with checkpoint information Updating control files with checkpoint information
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
Data Files Oracle Database Control Files Redo Log Files ARCn Archived Logs
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 File Data 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...fromorder by) Undo Used for transaction consistency during Insert / Update / Delete statements
Does MyTab exist? Does user have Privs to select from MyTab What columns are in MyTab What is the first column in MyTab
If Commit then
LGWn writes Redo Log Buffer entries to Redo Logs Undo entries are invalidated
If Rollback then
Migrate DB version of record in Undo back to tablespace/data file
Archivelog Mode
If Instance in Archivelog mode Redo Log Files are Archived to Archive Logs; which may be used to recover your database in the case of disaster
Data Files Oracle Database Control Files Redo Log Files ARCn Archived Logs
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.