Oracle Architecture PDF
Oracle Architecture PDF
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy
Program Agenda
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 3
Oracle Memory Architecture
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 4
Oracle TRANSACTION
A transaction is a logical, atomic unit of work that contains one or more SQL statements.
All Oracle transactions obey the basic properties of a database transaction, known as ACID properties.
ACID is an acronym for the following:
• Atomicity
All tasks of a transaction are performed or none of them are. There are no partial transactions.
• Consistency
The transaction takes the database from one consistent state to another consistent state.
• Isolation
The effect of a transaction is not visible to other transactions until the transaction is committed.
• Durability
Changes made by committed transactions are permanent. After a transaction completes, the database
ensures through its recovery mechanisms that changes from the transaction are not lost.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 5
Oracle Server Architecture
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 6
Oracle Instance and Database
• Oracle Database = Oracle Instance +
Database files (storage structures)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 7
Oracle Instance
• SGA – shared memory structures (used by all
server and background processes) that contain
data and control information for one Oracle
database instance.
• Background processes - perform maintenance
tasks required to operate the database and to
maximize performance for multiple users
– Mandatory
PMON, SMON, DBWR, LGWR,
CKPT, RECO, MMON+MMNL
(manageability processes), etc.
– Optional (may appear depending on options
or technologies used)
ARCH, RBAL, ACFS, etc.
• Server processes – opened in name of a user
connection (if dedicated server connection)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 8
Oracle Database Instance Configurations
• In Single instance or RAC environment, an instance is associated with one and only
one database at a time.
• Even if there are multiple single instances on a machine, each one is accessing its
own database
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 9
Oracle Basic Memory Structures
• Basic memory structures associated
with Oracle instance are:
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 10
System Global Area - SGA
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 11
Database Buffer Cache
Has 2 major goals:
- optimize physical I/O
- Keep frequently accessed blocks in the buffer cache
and write infrequently accessed blocks to disk
Buffer States (mutually exclusive)
- Unused
- Clean
- Dirty
A buffer could be:
- Pinned
- Free (unpinned)
Buffer Modes
- Current mode
- Consistent mode
Buffer Pools
- Default
ALTER SYSTEM SET DB_CACHE_SIZE = 96M; - Keep
- Recycle
The size of each buffer in the DEFAULT buffer cache is equal to the size of an Oracle block
(specified by the DB_BLOCK_SIZE parameter).
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 12
Redo Log Buffer
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 13
Shared Pool
Shared Pool components:
• Library Cache
– Shared SQL Area
– Private SQL Area
• Data Dictionary Cache
• Server Result Cache
– SQL Query Result Cache
– PL/SQL Function Result Cache
• Reserved Pool
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 14
SGA Components: Library Cache
The library cache stores information about the most recently used SQL
and PL/SQL statements. The library cache:
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 15
Shared SQL Areas
Statement 1: SELECT empno, ename from SCOTT.EMP;
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 16
Processing a DML statement
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 17
COMMIT Processing
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 18
Tuning Shared Pool
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 19
SGA Components: Dictionary Cache
The data dictionary cache is a collection of the most recently used definitions
in the database.
– It includes information about database files, tables, indexes, columns, users,
privileges, and other database objects.
– During the parse phase, the server process looks at the data dictionary for
information to resolve object names and validate access.
– Caching the data dictionary information into memory improves response
time on queries.
– Size is determined by the shared pool sizing.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 20
SGA Components: Large Pool
Optional area in SGA, used for large memory allocation in
case of:
- UGA for SHARED SERVER architecture
- Message buffers used in the parallel execution of
statements
- Buffers for Recovery Manager (RMAN) I/O slaves
Not deserved by a LRU algorithm
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 21
SGA Components: Java Pool
• The Java pool is an area of memory that stores all session-specific Java code and data
within the Java Virtual Machine (JVM).
• For dedicated server connections, the Java pool includes the shared part of each Java
class, including methods and read-only memory (but not session state)
• For shared server, the pool includes the shared part of each class and some UGA used
for the state of each session. Each UGA grows and shrinks as necessary, but the total
UGA size must fit in the Java pool space.
• The Java Pool Advisor statistics provide information about library cache memory used
for Java and predict how changes in the size of the Java pool can affect the parse rate
(need STATISTICS_LEVEL = TYPICAL or higher)
• It is sized by the JAVA_POOL_SIZE parameter
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 22
SGA Components: Streams Pool
• The Streams pool stores buffered queue messages and provides memory for Oracle
Streams capture processes and apply processes.
• Unless you specifically configure it, the size of the Streams pool starts at zero.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 23
SGA Components: Fixed SGA
• The size of the fixed SGA is set by Oracle Database and cannot be altered manually.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 24
SGA Components: Software Code Area
• Software code areas are portions of memory that store code that is being run or can be run.
• Oracle Database code is stored in a software area that is typically more exclusive and protected
than the location of user programs.
• Software areas are usually static in size, changing only when software is updated or reinstalled.
• Software areas are read-only and can be installed shared or non-shared (when possible, database
code is shared so that all users can access it)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 25
Program Global Area – PGA
What is PGA
– Memory structure specific to a non-shared process
(never allocated in SGA)
– Memory heap containing session-dependent
variables (for a dedicated or shared process)
• Automatic tuning by
PGA_AGGREGATE_TARGET <> 0
• Comprising of:
– SQL Work Areas
– Private SQL Area
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 26
Program Global Area – PGA (cont.)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 27
Program Global Area – PGA (cont.)
PGA – comparison between DEDICATED and SHARED SERVER architecture
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 28
SGA & PGA – content during life span
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 29
UGA and Oracle Shared Server
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 30
Diagram of typical relationships between caches
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 31
Automatic Memory Management (AMM)
10g approach 11g approach
Automatic Memory Management can now automatically
•Automatic Shared Memory Management (ASSM) provided
manage both the system global area (SGA) and the program
•Some structures are automatic resized based on loading global area (PGA).
•Automatically Managed SGA Components
Automatic memory management done by:
-Shared pool (for SQL and PL/SQL execution) -setting MEMORY_TARGET and MEMORY_MAX_TARGET
-unsetting SGA_TARGET and PGA_AGGREGATE_TARGET
-Java pool (for Java execution state)
-Large pool (for large allocations such as RMAN backup buffers)
-Buffer cache (default pool)
-Streams pool
•Manually Managed SGA Components
-Keep/Recycle buffer caches
-Additional buffer caches for non-standard block sizes
•Specify SGA_TARGET <> 0 (but <= SGA_MAX_SIZE) and
STATISTICS_LEVEL = TYPICAL or ALL
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 32
Automatic Memory Management – AMM (cont.)
Oracle will automatically size the Program Global Area (PGA) and System Global
Area (SGA) based on the workload
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 33
Automatic Memory Management – AMM (cont.)
• MEMORY_TARGET parameter is
dynamic and can be changed up to
and including the value of
MEMORY_MAX_TARGET.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 34
Automatic Memory Management – AMM (cont.)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 35
Automatic Memory Management – AMM (cont.)
Automatic Memory Management – For Both SGA, PGA Oracle tunes:
• You set MEMORY_TARGET > 0 and optional •Total SGA size
MEMORY_MAX_TARGET •SGA component sizes
•Instance PGA size
•Individual PGA sizes
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 36
Automatic Memory Management – AMM (cont.)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 37
Oracle Processes- Overview
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 38
Oracle Process Types
Process = interface (link) between user -> storage structures -> memory structures
• Server Processes
– Created on behalf of a user application to perform tasks like:
• Parse or run SQL statements
• Execute PL/SQL code
• Reads data blocks from database file into buffer cache (DBWR writes back changes!)
• Returns data to application requested it
– In DEDICATED SERVER architecture one Server process is associated with one and only one client connection
– In SHARED SERVER architecture client connections are handled by a DISPATCHER process
• Background Processes
– Created by Oracle engine upon database startup and managed internally by Oracle code
– Could be:
• Mandatory (PMON, SMON, DBWR, LGWR, CKPT, RECO, etc.)
• Optional (ARCH, Dnnn, RBAL, etc.)
• Slave processes (background processes that perform work on behalf of other processes)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 39
DEDICATED SERVER Architecture
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 40
SHARED SERVER Architecture
Controlled by parameters:
• SHARED_SERVERS
• MAX_SHARED_SERVERS
• SHARED_SERVER_SESSIONS
• DISPATCHERS
• MAX_DISPATCHERS
• CIRCUITS
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 41
Establishing a Connection and Creating a Session
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 42
Server Process
A server process is a program that directly interacts with the Oracle
server.
– It fulfills calls generated and returns results.
– Can be dedicated or shared server.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 43
Background Process
The relationship between the physical and memory structures is
maintained and enforced by Oracle’s background processes.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 44
Database Writer (DBWn)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 45
Log Writer (LGWR)
LGWR writes:
– At commit
– When one-third full
– When there is 1 MB of redo
– Every 3 seconds
– Before DBWn writes
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 46
System Monitor (SMON)
Responsibilities:
–Instance recovery:
‒Rolls forward changes in the redo logs
‒Opens the database for user access
‒Rolls back uncommitted transactions
–Coalesces free space ever 3 sec
–Deallocates temporary segments
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 47
Process Monitor (PMON)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 48
Checkpoint Process (CKPT)
Responsible for:
–Signaling DBWn at checkpoints
–Updating datafile headers with
checkpoint information
–Updating control files with
checkpoint information
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 49
Archiver Process (ARCn)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 50
Physical Database Structure
• Mandatory Files
• Additional Files
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 51
Database Storage Structure
Oracle Database storage
• Physical structure
• Logical structure
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 52
Initialization Parameter file
When you start the instance, an initialization parameter file is read. There are
two types of parameter files:
– Server parameter file: This is the preferred type of initialization parameter
file (binary file)
– Text initialization parameter file: This type of initialization parameter file can
be read by the database server, but it is not written to by the server
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 53
Starting Up Oracle Instance
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 54
Starting Up Oracle Instance (cont.)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 55
Shutting Down Oracle Instance
Shutdown Modes
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 56
Shutting Down Oracle Instance (cont.)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 57
Oracle 12c – New Paradigm
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 58
Oracle 12c Multitenant Architecture
Requires memory, processes and database files
System Resources
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 59
Oracle 12c – New Multitenant Architecture
Memory and processes required at multitenant container level only
System Resources
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 60
Oracle Multitenant Database Architecture
The multitenant architecture enables an Oracle database to function as a multitenant
container database (CDB) that includes zero, one, or many customer-created pluggable
databases (PDBs).
A PDB is a portable collection of schemas, schema objects, and non-schema objects that
appears to an Oracle Net client as a non-CDB. All Oracle databases before Oracle Database
12c were non-CDBs.
A container is either a PDB or the root container (also called the root). The root is a collection
of schemas, schema objects, and non-schema objects to which all PDBs belong
Every CDB has the following containers:
Exactly one root
Exactly one seed PDB
Zero or more user-created PDBs
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 61
Oracle 12c Multitenant Architecture (cont.)
Sample of a CDB with four containers:
Root
Seed
Two PDBs (hr and sales).
Each PDB has its own dedicated application,
managed by its own PDB administrator.
A common user exists across a CDB with a
single identity. In this example, common
user SYS can manage the root and every PDB.
A local user is specific to a particular PDB and
owns a schema in this PDB.
At the physical level, this CDB has a database
instance and database files, just as a non-
CDB does.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 62
Oracle 12c Multitenant Architecture (cont.)
From a physical perspective, a CDB has basically the same structure as a non-CDB, except that each PDB has
its own set of tablespaces (including its ownSYSTEM and SYSAUX tablespaces) and data files (example: a CDB
with two PDBs: hrpdb and salespdb).
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/poster/OUTPUT_poster/poster.html
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 63
Oracle 12c Multitenant Architecture (cont.)
PDBs
Root
Pluggable Databases (PDBs)
CDB
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 64
Oracle 12c Multitenant Architecture (cont.)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 65
Oracle 12c – CDB & PDB big picture
background
control files redo log files flashback log files SGA
processes
Root
SYS Public CDBA
Oracle Supplied Common Users/Schemas/Objects
Customer Common Users
SYSTEM SYSAUX UNDO TEMP
(global) (global)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 67
[email protected]
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle ACS for Oracle Academy 68