This PowerPoint is based on slides from: Byron Bush, Scott S. Hilpert and Lee, JeongKyu.
-
Upload
ernest-widdowson -
Category
Documents
-
view
213 -
download
0
Transcript of This PowerPoint is based on slides from: Byron Bush, Scott S. Hilpert and Lee, JeongKyu.
Most people call it a “Database”Technically an Oracle Database is broken into
two high-level components
1. INSTANCE – Non-persistent, memory-based processes and structures
2. DATABASE – Persistent, disk-based data and control files
So Why Differentiate?Most Oracle installations consist of only a
single “Instance” and single “Database”…
Instance
Database
Oracle RAC is DifferentOracle “Real Application Clusters” allow
multiple “Instances” to interact with a single “Database” to provide high availability…
Instance 1
Database
Instance 3Instance 2
Oracle ArchitectureInstanceAn Oracle instance:
Is a means to access an Oracle databaseAlways opens one and only one database
Consists of:Internal memory structuresProcesses
Oracle ArchitectureInteraction with the Database ( Dedicated Server )
SGA
Request Response
Shared SQLPool Database Buffer Cache
Redo log Buffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR ARCn
PMONSMONCKPT
SGA
Request Response
Shared SQLPool Database Buffer Cache
Redo log Buffer
Database Files Redo Log Files
UserProcess
DBWR LGWR ARCn
PMONSMON
DedicatedServerDedicated
ServerSharedServers
UserProcessUser
ProcessUserProcessUser
Process
Dispatcher
CKPT
Oracle ArchitectureInteraction with the Database ( Shared Server )
Oracle ArchitectureDatabase buffer cache
Used to hold data blocks read from datafiles by server processes
Contains ‘dirty’ or modified blocks and ‘clean’ or unused or unchanged bocks
Free space is created by DBWR writing out ‘dirty’ blocks or aging out blocks from the LRU
Size is managed by the parameter DB_BLOCK_BUFFERS
Oracle ArchitectureRedo Log Buffer
A circular buffer that contains redo entriesRedo entries reflect changes made to the
databaseRedo entries take up contiguous, sequential
space in the bufferData stored in the redo log buffer is
periodically written to the online redo log filesSize is managed by the parameter
LOG_BUFFERDefault is 4 times the maximum data block size
for the operating system
Memory Structure : Shared Pool
Shared Pool
Library Cache
Shared SQL Area
PL/SQL Procedures
and Package
Control Structuresfor examples;
LocksLibraryCache handlesand so on ...
Dictionary Cache
Control Structuresfor example:
Character SetConversion MemoryNetwork Security Attributes
and so on ..
Shared Pool Contents
- Text of the SQL or PL/SQL statement
- Parsed form of the SQL or PL/SQL statement
- Execution plan for the SQL or PL/SQL statements - Data dictionary cache containing rows of data dictionary information
Library Cache - shared SQL area - private SQL area - PL/SQL procedures and package - control structures : lock and library cache handles Dictionary Cache - names of all tables and views in the database - names and datatypes of columns in database tables - privileges of all Oracle users SHARED_POOL_SIZE
ReusableRuntimeMemory
Oracle ArchitectureInternal Memory Structures PGA
Program or ‘process’ Global Area (PGA)Used for a single processNot shareable with other processesWritable only by the server processAllocated when a process is created and
deallocated when a process is terminatedContains:
Sort area – Used for any sorts required by SQL processing
Session information – Includes user privileges Cursor state – Indicates stage of SQL processing Stack space – Contains session variables
Oracle ArchitectureBackground Processes - DBWRWrites contents of database buffers to
datafilesPrimary job is to keep the database buffer
‘clean’Writes least recently used (LRU) ‘dirty’
buffers to disk firstWrites to datafiles in optimal batch writesOnly process that writes directly to datafilesMandatory process
Oracle ArchitectureBackground Processes - DBWRDBWR writes to disk when:
A server process cannot find a clean reusable buffer
A timeout occurs (3 sec)A checkpoint occursDBWR cannot write out ‘dirty’ buffers before
they have been written to the online redo log files
Oracle ArchitectureBackground Processes - LGWR
Writes contents of redo log buffers to online redo log files
Primary job is to keep the redo log buffer ‘clean’
Writes out redo log buffer blocks sequentially to the redo log files
May write multiple redo entries per write during high utilization periods
Mandatory process
Oracle ArchitectureBackground Processes - LGWR
LGWR writes to disk when:A transaction is COMMITEDA timeout occurs (3 sec)The redo log buffer is 1/3 fullThere is more than 1 megabyte of redo entriesBefore DBWR writes out ‘dirty’ blocks to
datafiles
Oracle ArchitectureBackground Processes - SMON
Performs automatic instance recoveryReclaims space used by temporary
segments no longer in useMerges contiguous areas of free space in
the datafiles (if PCTINCREASE > 0)SMON ‘wakes up’ regularly to check
whether it is needed or it may be called directly
Mandatory process
Oracle ArchitectureBackground Processes - SMON
SMON recovers transactions marked as DEAD within the instance during instance recoveryAll non committed work will be rolled back by
SMON in the event of server failureSMON makes multiple passes through DEAD
transactions and only applies a specified number of undo records per pass, this prevents short transactions having to wait for long transactions to recover
SMON primarily cleans up server-side failures
Oracle ArchitectureBackground Processes - PMON
Performs automatic process recoveryCleans up abnormally terminated connectionsRolls back non committed transactionsReleases resources held by abnormally
terminated transactionsRestarts failed shared server and dispatcher
processesPMON ‘wakes up’ regularly to check
whether it is needed or it may be called directly
Mandatory process
Oracle ArchitectureBackground Processes - PMON
Detects both user and server aborted database processes
Automatically resolves aborted processes PMON rolls back the current transaction of the
aborted processReleases resources used by the processIf the process is a background process the
instance most likely cannot continue and will be shut down
PMON primarily cleans up client-side failures
Oracle ArchitectureBackground Processes - CKPT
Forces all modified data in the SGA to be written to datafileOccurs whether or not the data has been committedCKPT does not actually write out buffer data only DBWR
can write to the datafilesUpdates the datafile headers
This ensures all datafiles are synchronizedHelps reduce the amount of time needed to
perform instance recoveryFrequency can be adjusted with parameters
Oracle ArchitectureBackground Processes - ARCH
Automatically copies online redo log files to designated storage once they have become full
Oracle ArchitectureServer Processes
Services a single user process in the dedicated server configuration or many user processes in the shared server configuration
Use an exclusive PGAInclude the Oracle Program Interface (OPI)Process calls generated by the clientReturn results to the client in the dedicated
server configuration or to the dispatcher in the shared server configuration
Oracle ArchitectureUser ProcessesRun on the client machineAre spawned when a tool or an application is
invokedSQL*Plus, Server Manager, Oracle Enterprise
Manager, Developer/2000Custom applications
Include the User Program Interface (UPI)Generate calls to the Oracle server
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
1
2
UPDATE tableSET user = ‘SHIPERT’WHERE id = 12345
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
3
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
4
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
5
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
6
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
7
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
81 ROW UPDATED
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
109COMMIT
Oracle ArchitectureTransaction Example - Update
SGA
DatabaseBufferCache
Shared Pool
RedoLogBuffer
Database Files Redo Log Files
DedicatedServer
UserProcess
DBWR LGWR
PMONSMONCKPT
RollbackSegment
11COMMITSUCCESSFUL