4
Oracle Memory Architecture - 1 - There are five memory structures that make up the System Global Area (SGA). SGA Shared Pool The shared pool consists of the following areas: Library cache includes the shared SQL area, private SQL areas, PL/SQL procedures and packages the control structures such as locks and library cache handles Dictionary cache is a collection of database tables and views containing information about the database, its structures and users. Buffers for parallel execution messages and control structures Buffer cache This area holds copies of read data blocks from the datafiles. The buffers in the cache contain two lists, thwe write list and the least used list (LRU). The write list holds dirty buffers which contain modified data not yet written to disk. The least used list holds free buffers (no useful data) , pinned buffers (being accessed) and dirty buffers that have not yet been moved to the write list. The size is deteremnied by the following in the system paramenter file: DB_2K_CACHE_SIZE DB_4K_CACHE_SIZE DB_8K_CACHE_SIZE DB_16K_CACHE_SIZE DB_32K_CACHE_SIZE Redo buffer Is a circular buffer that holds information about changes made to the database, this information is stored in redo entries. These entries contain necessary information to reconstruct/redo changes by the INSERT, UPDATE, DELETE, CREATE, ALTER and DROP commands. Large Pool This is an optional memory area that provide large areas of memory for: Session memory I/O server processes Backup and Restore Parallel execution message buffers. Java Pool used to execute java code within the database.

Oracle Memory Architecture in oracle 10g

Embed Size (px)

DESCRIPTION

this pdf ll explain abt Oracle Memory Architecture(SGA &PGA)

Citation preview

Page 1: Oracle Memory Architecture in oracle 10g

Oracle Memory Architecture - 1 -

There are five memory structures that make up the System Global Area (SGA).

SGA

Shared Pool

The shared pool consists of the following areas:

Library cache includes the shared SQL area, private SQL areas, PL/SQL procedures and packages the control structures such as locks and library cache handles

Dictionary cache is a collection of database tables and views containing information about the database, its structures and users.

Buffers for parallel execution messages and control structures

Buffer cache

This area holds copies of read data blocks from the datafiles. The buffers in the cache contain two lists, thwe write list and the least used list (LRU). The write list holds dirty buffers which contain modified data not yet written to disk. The least used list holds free buffers (no useful data) , pinned buffers (being accessed) and dirty buffers that have not yet been moved to the write list.

The size is deteremnied by the following in the system paramenter file:

DB_2K_CACHE_SIZEDB_4K_CACHE_SIZEDB_8K_CACHE_SIZEDB_16K_CACHE_SIZEDB_32K_CACHE_SIZE

Redo buffer Is a circular buffer that holds information about changes made to the database, this information is stored in redo entries. These entries contain necessary information to reconstruct/redo changes by the INSERT, UPDATE, DELETE, CREATE, ALTER and DROP commands.

Large Pool

This is an optional memory area that provide large areas of memory for:

Session memoryI/O server processesBackup and Restore

Parallel execution message buffers.

Java Pool used to execute java code within the database.

Page 2: Oracle Memory Architecture in oracle 10g

Oracle Memory Architecture - 2 -

Display information regarding the SGA

Memory area Memory location

Displaying the information

SGA sql> show sga;

SGA (detailed) use table v$sgastat;

Buffer cache SGA use table v$bh;

Display memory allocation

SGA

compute sum of bytes on poolbreak on pool skip 1

select pool, name bytesfrom v$sgastatorder by pool, name

Display the redo buffer SGA select * from v$sga where name = 'Redo Buffers'

Library cache shared pool use table v$librarycache;

Dictionary cache shared pool use table v$rowcache;

PGA

Each process connected to the database requires its own area of memeory this is know as the Program Global Area (PGA). This area stores variables, arrays and other information that do not need to be shared with other processes.

Session Information

PGA in an instance running without the multi-threaded server (named Shared Server in Oracle9i) requires additional memory for the user's session, such as private SQL areas and other information. If the instance is running the multi-threaded server, this extra memory is not in the PGA, but is instead allocated in the SGA (the Shared Pool).

Stack space The memory allocated to hold a sessions variables, arrays, etc and other information relating to the session. However for a shared server the session memory is shared and not private

Display information regarding the PGA

Session v$sesstat, v$statname

Page 3: Oracle Memory Architecture in oracle 10g

Oracle Memory Architecture - 3 -

Stack

Display PGA and UGA usage

select a.name, b.namefrom v$statname a, v$mystat bwhere a.statistic# = b.statistic#and a.name like '%ga %'

Server Processes

There could be upto 11 server process depending on the server configuration

Process Monitor PMON

Responsible for cleaning up after abnormally terminated connections. Responsible for monitoring other server processes and restarting them if necessaryRegisters the instance with the listener.

System Monitor SMON

Temporary space cleanupCrash recovery apon restart Coalescing free spaceRecovering transactions active against unavailable filesInstance recovery of failed node in OPS (Oracle parallel server)Cleans up OJB$ (Low Level data dictionary)Shrinks rollback segmentsOfflines rollback segments

Distributed database recovery

RECORecovers transactions that are left in a prepared state because of a crash or loss of connection during a two-phase commit.

Checkpoint process CKPTIt does not do the checkpoint but assists with the checkpointing process by updating the file headers of the data files.

Database block writer DBWnResponsible for writing dirty blocks to disk, it writes the dirty blocks from the buffer.

Log writer LGWR

Responsible for flushing to disk the contents of the redo log buffer located in the SGA.

It does this: Every 3 seconds Whenever you commit When the redo log buffer is a third full or contains 1 Mb of bufferd data

Archive process ARCnCopy online redo log file to another location when LGWR fills up, these log files would be used to perform media recovery.

Block server process BSPUsed in OPS and keeps each servers SGA in the clusters consistent with each other.

Lock monitor process LMONUsed in OPS and monitors all instances in a cluster to detect a failure of an instance.

Lock manager daemon LMDUsed in OPS and controls the global locks and global resources for the block buffer cache in a clustered environment.

Page 4: Oracle Memory Architecture in oracle 10g

Oracle Memory Architecture - 4 -

Lock process LCKnUsed in OPS and is the same as the LMD daemon but handles requests for all global resources other than database block buffers