You are on page 1of 20

Oracle Memory Structures

When an instance is started, Oracle Database allocates a memory area and


starts background processes. The memory area stores information such as
the following:
• Program code
• Information about each connected session, even if it is not currently active
• Information needed during program execution, for example, the current state of
a query from which rows are being fetched
• Information such as lock data that is shared and communicated among
processes
• Cached data, such as data blocks and redo records, that also exists on disk

1-1 Copyright © 2005, Oracle. All rights reserved.


1-2 Copyright © 2005, Oracle. All rights reserved.
System global area (SGA)

• The SGA is a group of shared memory structures, known as SGA


components, that contain data and control information for one Oracle
Database instance.
• The SGA is shared by all server and background processes.
• Examples of data stored in the SGA include cached data blocks and
shared SQL areas.

1-3 Copyright © 2005, Oracle. All rights reserved.


Program global area (PGA)
• Program global area (PGA) is a memory area used by a single oracle database server process.

• When we connect to an oracle database instance, we create a session that uses a server process
for communication between the client and database instance.
• Each server process has its own PGA.
• The PGA is used to process SQL statements and to hold logon and other session information.
• The amount of PGA memory used and the contents of the PGA depend on whether the instance is
running in the dedicated or shared server mode.

• The total memory used by all individual PGAs is known as total instance PGA memory, or instance
PGA
• Setting the size of the instance PGA in database control files, not individual PGAs.
User Global Area (UGA):
The UGA is memory associated with a user session.

1-4 Copyright © 2005, Oracle. All rights reserved.


Database Buffer Cache
• The database buffer cache, also called the buffer cache, is the memory area that
stores copies of data blocks read from data files.
• Buffer manager temporarily caches a currently or recently used data block.
• All users concurrently connected to a database instance share access to the buffer
cache.
• The database updates data blocks in the cache and stores metadata about the changes
in the redo log buffer. After a COMMIT the database writes the redo buffers to disk but
does not immediately write data blocks to disk. Instead, database writer
(DBWn) performs lazy writes in the background.
• Keep frequently accessed blocks in the buffer cache and write infrequently accessed
blocks to disk

1-5 Copyright © 2005, Oracle. All rights reserved.


1-6 Copyright © 2005, Oracle. All rights reserved.
Database Buffer Cache

Cache Hit: if process finds the data already in the cache (cache hit ), it can
read the data directly from the memory.
Cache Miss: if the process can’t find the data in the cache ( cache miss )
It must copy the data block from the data file on disk into a buffer in the cache
before accessing the data.

• Accessing the data through cache hit is faster than access through a
cache miss.

1-7 Copyright © 2005, Oracle. All rights reserved.


Redo Log Buffer

Is a circular buffer in SGA


Holds information about changes made to database
Contains the redo entries that have the information to redo changes
made by operations such as DML and DDL.
The redo log Buffer is a place where data or entries are stored before
writing to redo log file.
All entries are written serially due to redo log file due to SCN
When user commits the data the data written to redo log file

The background process log writer (LGWR) writes the redo log buffer to the
active online redo log group on disk.

1-8 Copyright © 2005, Oracle. All rights reserved.


1-9 Copyright © 2005, Oracle. All rights reserved.
Shared pool
The shared pool caches various types of program data. For example, the
shared pool stores parsed SQL, PL/SQL code, system parameters, and data
dictionary information. The shared pool is involved in almost every operation
that occurs in the database. For example, if a user executes a SQL statement,
then Oracle Database accesses the shared pool.
• Library Cache
• Data Dictionary Cache
• Server Result Cache
• Reserved Pool

1-10 Copyright © 2005, Oracle. All rights reserved.


1-11 Copyright © 2005, Oracle. All rights reserved.
Shared pool

Library Cache:
• Shared SQL Area
• Private SQL Area
• PL/SQL procedures and package
Data Dictionary Cache
• Names of all tables and views in the database
• Names and datatypes of columns in the database tables
• Priviliges of all oracle users

1-12 Copyright © 2005, Oracle. All rights reserved.


Shared pool

Server Result Cache


• Automatically caches results of queries, query blocks, or pl/sql
function calls
• Cache is shared across statements and sessions on server
• Significant speed up for read-only
The reserved pool
• The reserved pool is a memory area in the shared pool that Oracle
Database can use to allocate large contiguous chunks of memory.

1-13 Copyright © 2005, Oracle. All rights reserved.


Streams pool

The Streams pool stores buffered queue messages and provides memory for
Oracle Streams capture processes and apply processes.
The Streams pool is used exclusively by Oracle Streams.
Unless you specifically configure it, the size of the Streams pool starts at zero.
The pool size grows dynamically as required by Oracle Streams.

1-14 Copyright © 2005, Oracle. All rights reserved.


Large pool

• The large pool is an optional memory area.


• Here AMM take place.
• You don’t need to define the size of five pools
• The large pool can provide large memory allocations for the following:
• UGA for the shared server and the Oracle XA interface (used where
transactions interact with multiple databases)
• Message buffers used in the parallel execution of statements
• Buffers for Recovery Manager (RMAN) I/O slaves

1-15 Copyright © 2005, Oracle. All rights reserved.


Large pool

• By allocating session memory from the large pool for shared SQL, the
database avoids performance overhead caused by shrinking the shared
SQL cache.
• By allocating memory in large buffers for RMAN operations, I/O server
processes, and parallel buffers, the large pool can satisfy large memory
requests better than the shared pool.

1-16 Copyright © 2005, Oracle. All rights reserved.


1-17 Copyright © 2005, Oracle. All rights reserved.
Java pool

• The java pool services the parsing requirements for JAVA commands.
• Required if installing and using java.
• It is stored much the same way as PL/SQL in database tables.
• It is sized by the JAVA_POOL_SIZE parameter.
• Oracle uses java, if you don’t.

1-18 Copyright © 2005, Oracle. All rights reserved.


Stream Pool

Stream pool is used exclusively by Oracle Streams to:


• Store buffered queue messages
• Provide memory for oracle streams

1-19 Copyright © 2005, Oracle. All rights reserved.


Oracle Instance

An oracle database server consist of an oracle database and oracle


instance.
Every time database is started, a system global area(SGA) is allocated
and oracle background processes are started.
The combination of background processes and memory buffers is called
an oracle instance.

1-20 Copyright © 2005, Oracle. All rights reserved.

You might also like