An instance: Which is basically a set of memory structures and background processes that cache the most used data, and serve as an exchange point between the users(clients) and the datafiles that have the information on disks. Datafiles : These datafiles are located on hard disks, and they compose all the data that is stored in Oracle,control files,tablespaces, redo-log files,etc. Oracle-Software : This contains the Oracle-kernel which is much like a sub-operating system on top of the host system , because it coordinates the memory-structures and processes (Instance) and the file updates (Datafiles) on the hard drives.

1………… SGA >Database Buffer Cache(depends on DB_BLOCK_SIZE & DB_BLOCK_BUFFERS parameters) >Redo Log Buffer (depends on LOG_BUFFER , monitored V$SYSSTAT ) >Shared Pool (depends on SHARED_POOL_SIZE ) >>Library Cache .Shared SQL Areas (Contains the parse tree and execution plan for a single SQL statement) .Private SQL Areas (Contains data such as bind information and runtime buffers,each session that issues a SQL statement has a private SQL area;many private SQL areas can be associated with the same shared SQL area, if a session is connected via a dedicated server private SQL areas are in the users PGA. If the sessions connected via the multi-threaded server, the private area is kept in the SGA ) ..Persistent (Contains bind information that persists accorss executions,code for data type conversion and other state information, in contrast to Runtime,the persistent area remains waiting after the statement completes, the open cursors that will not be used should be closed to free the persistent area and to minimize the amount of memory required for the application) ..Runtime ( Contains information used while the SQL statement is being executed, it is the first step in an execute REQUEST, it releases this memory when the statement finishes) >>Dictionary Cache (Also known as the row cache, because it holds data as rows instead of buffers) >>Control Structures >Large Pool (Optional,used for large memory allocations) MTS- to allocate uga in sga 2…….. PGA : backup – for rman disk I/o buffers A PGA (Process Global area ) is a memory region containing data and control information for a single process. One PGA is allocate for each server process. b. Stack Space: A PGA always contains stack space, which is memory allocate to hold a sessions variables,arrays, and other information. c. Session Information : If the instance is in single-serer mode, the PGA also contains information about the users session, such a private SQL areas. If the instance is in multi-threaded server, this session information is not in the PGA, but is instead allocated in the SGA. The PGA's initial size is fixed and OS specific, however the parameters OPEN_LINKS and DB_FILES affect the sizes of PGAs. d. Sort Areas : Use memory from the PGA of the Oracle server process that performs the sort on behalf of the user process. However, a part of the sort area ( up to SORT_AREA_RETAINED) exists in the runtime area of the process's private SQL area. The sort area can grow up to limit SORT_AREA_SIZE.

1. 2.



Background Processes DBWR (Writes the modified (dirty) buffers in the database buffer cache to disk) LGWR (Writes the redo log buffer contents to a redo log file on disk, it write of the buffer to disk when : A user process commits a transaction, every three seconds, when the redo-log buffer is one-third full, when a DBWn process writes modified buffers to disk) PMON (Process Monitor, performs process recovery when a user processes fails, it is responsible for cleaning up the database buffer cache and freeing resources that the user process was using ) SMON (System Monitor, Performs crash recovery , if necessary at instance startup, it is also responsible for coalescing contiguous free space within table spaces, and cleaning up temporary segments that are no longer in use) ARCH : Copies online redo log files to a designated storage device once they become full or when the ALTER SYSTEM SWITCH LOGFILE command forces a log switch. CKPT (when a checkpoint occurs , Oracle must update the headers of all data files to record the details of the checkpoint.) RECO : Used with distributed database configurations to automatically resolve failed distributed transactions SNPn ( Job Queue/Snapshot Process): With the distributed database configuration, up to 36 job queues can automatically refresh table snapshots. LCKn : In Oracle Parallel Server, a lock process provides inter-instance locking QMN ( Queue Monitor) (Optional for Oracle Advanced Queuing which monitors the message queues) Snn (shared Server Processes serve multiple client requests in the multi-threaded server configuration ) Dnn (Dispatcher Processes, support multi-threaded configuration by allowing user processes to share limited number of server processes. Pnnn (Parallel query processes)

5. 6. 7. 8. 9. 10. 11. 12. 13.

List the Stages in processing:queries,DML statements, COMMITS.

Queries : The server session hashes de SQL statement passed to it and compares that hash number with the hash numbers of statements already saved in the Shared SQL area. If an exact duplicate of the statement is found in the shared pool, the parsed form of the statement and the execution plan that are already stored are used. If a match is not found in the shared pool, the server session parses de statement. Next, the server checks to see wheter the data blocks necessary to complete the transaction (query) are already stored in the database buffer cache. If the block are not in the buffer, the server reads the necessary blocks from the data files and copies them into the cache. NOW it returns the information. DML Statements : It performs the same steps up to when the data is copied into the buffer (data block buffer cache), before it returns the information (as is the case with a query),the blocks in memory (the cache) are modified accordingly. Once they are modified in memory these blocks are marked as dirty, and are placed on the dirty list. Redo log information is also generated on this transaction and placed in the redo-log cache. Up to this point any of the following can occur: 1 The user commits, this signals the LGWR to flush the redo-log buffer to the online redolog file. 2 The redo information that was generated causes de redo-log buffer to become one-third full. This triggers a redo-log buffer flush by LGRW 3 The number of dirty blocks reached a threshold length. This triggers DBWR to flush all the dirty blocks in the database buffer cache to the data files, which in turn also causes LGWR to flush the redo-log buffers to the online-redo log files. 4 A database checkpoint occurs. This triggers the database buffer cache ( with DBWR) as well as the redo-log buffers ( with LGRW) to flush. 5 The number of available free buffers in the buffer cache drops below the threshold value. This also causes the database buffer cache to flush 6 An unrecoverable error occurs. This forces the transaction to be terminated and rolled back and an error reported back to the server session.
NOTE: The transaction never records as successful until the redo-log buffer successfully writes to the online redo-log files. This demonstrates the importance of the LGRW and ARCH processes.

Oracle Architecture


Oracle Architecture
Instance Architecture

Instance SGA
Shared pool
Library Cache Database Buffer Cache Redo Log Buffer Data Dictionary Cache












Oracle Architecture
Interaction with the Database ( Dedicated Server )

Oracle Architecture
Interaction with the Database ( Shared Server )

Oracle Architecture
System or ‘shared’ Global Area (SGA)
– – – – –

Internal Memory Structures SGA

Database buffer cache Redo log buffer Shared pool Request & response queues (shared server) System Global Area (SGA), which is shared by all server and background processes.

• A system global area (SGA) is a group of shared memory structures that contain data and control information for one Oracle database instance. If multiple users are • Concurrently connected to the same instance, then the data in the instance’s SGA is • shared among the users. Consequently, the SGA is sometimes called the shared global area

Oracle Architecture
Database 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 • ‘Dirty’ and ‘clean’ blocks are managed in lists called the dirty list and the LRU • 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 Architecture
Redo Log Buffer

• A circular buffer that contains redo entries
– Redo entries reflect changes made to the database

• Redo entries take up contiguous, sequential space in the buffer • Data stored in the redo log buffer is periodically written to the online redo log files • Size is managed by the parameter LOG_BUFFER
– Default is 4 times the maximum data block size for the operating system

Oracle Architecture
Shared Pool
• Consists of multiple smaller memory areas
– Library cache
• Shared SQL area
– Contains parsed SQL and execution plans for statements already run against the database

• Procedure and package storage

– Dictionary cache
• Names of all tables and views in the database • Names and datatypes of columns in the database tables • Privileges of all users

• Managed via an LRU algorithm • Size determined by the parameter SHARED_POOL_SIZE

Oracle Architecture
Background Processes - DBWR

• Writes contents of database buffers to datafiles • Primary job is to keep the database buffer ‘clean’ • Writes least recently used (LRU) ‘dirty’ buffers to disk first • Writes to datafiles in optimal batch writes • Only process that writes directly to datafiles • Mandatory process

Oracle Architecture
Background 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 Architecture
Background Processes - SMON

• SMON recovers transactions marked as DEAD within the instance during instance recovery
– All non committed work will be rolled back by SMON in the event of server failure – SMON 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 Architecture
Background Processes - PMON

• Detects both user and server aborted database processes • Automatically resolves aborted processes
– PMON rolls back the current transaction of the aborted process – Releases resources used by the process – If 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 Architecture
Background Processes - CKPT
• Forces all modified data in the SGA to be written to datafile
– Occurs whether or not the data has been committed – CKPT does not actually write out buffer data only DBWR can write to the datafiles

• Updates the datafile headers
– This ensures all datafiles are synchronized

• Helps reduce the amount of time needed to perform instance recovery • Frequency can be adjusted with parameters

Oracle Architecture
Background Processes - ARCH

• Automatically copies online redo log files to designated storage once they have become full

Oracle Architecture
Transaction Example - Update

UPDATE table SET user = ‘SHIPERT’ WHERE id = 12345

Oracle Architecture
Transaction Example - Update

Oracle Architecture
Transaction Example - Update

Oracle Architecture
Transaction Example - Update

Oracle Architecture
Transaction Example - Update

Oracle Architecture
Transaction Example - Update

Oracle Architecture
Transaction Example - Update


Oracle Architecture
Transaction Example - Update


Oracle Architecture
Transaction Example - Update


Oracle Architecture
Transaction Example - Update

What is PGA ?
• • • • Program Global Area i.e. Process Global Area Why is PGA different from SGA What goes into PGA
– Sort – Hash – PL/SQL variables and cursor memory

• Program Global Areas (PGA), which is private to each server and background process; there is one PGA for each process

Oracle Architecture
Internal Memory Structures PGA

Program or ‘process’ Global Area (PGA)
– – – – Used for a single process Not shareable with other processes Writable only by the server process Allocated when a process is created and deallocated when a process is terminated – Contains:
• • • • 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 memory model
cursors pl/sql var.

Sort Hash

cursorspl/sql var.



cursors pl/sql var.


cursors pl/sql var.


Architecture: Thread Model
Oracle process SGA 3GB or 8TB total
SGA contains db buffers, log buffers shared pool, other memory allocations Each thread consists of PGA, stack, other memory allocations

Background and foreground threads Code


Text and slide content Copyright © 2003 Intel Corporation. Slide background Copyright © 2003 Oracle Corporation.. *Other names and brands may be claimed as the property of others.

Sign up to vote on this title
UsefulNot useful