| Lesson 12 | Oracle Memory Architecture Conclusion |
| Objective | Synthesize how Oracle AI Database 26ai uses and manages shared and private memory. |
Oracle memory architecture is easier to understand when it is viewed as a coordinated system rather than as a list of caches and parameters. An Oracle instance uses shared memory to make reusable information available to many processes and private memory to preserve the state of an individual process, session, or SQL execution. Those two responsibilities establish the central boundary developed throughout this module: the System Global Area (SGA) is shared, while each Program Global Area (PGA) belongs to one Oracle process.
That boundary explains the placement of nearly every structure studied in the preceding lessons. Cached database blocks, parsed SQL, metadata, and redo records can benefit multiple processes, so they reside in SGA components. Bind values, cursor execution state, call-stack data, and SQL work areas are private to a process or execution, so they normally reside in a PGA. Oracle then manages the individual structures and their aggregate sizes according to workload, configuration, database features, and available memory.
The lessons move from the shared-versus-private model to the major components and then to the behavior of a specific PGA work area. Use this sequence as both a review and a map for returning to a topic that needs more detail.
| Lesson | Topic | Central idea |
|---|---|---|
| 1 | Introduction to Oracle Memory Architecture | The SGA contains shared instance memory; each Oracle process has private PGA memory. |
| 2 | System Global Area | The SGA is allocated for an instance and contains shared caches, buffers, and control information. |
| 3 | Database Buffer Cache | Oracle performs logical access against cached copies of data blocks and writes dirty buffers asynchronously. |
| 4 | Multiple Buffer Pools | DEFAULT, KEEP, and RECYCLE pools can separate selected access patterns when measurements justify the design. |
| 5 | Redo Log Buffer | Change vectors accumulate in a shared circular buffer before LGWR writes them to online redo logs. |
| 6 | Oracle Shared Pool | The library cache and data dictionary cache support reusable SQL, metadata access, and parsing. |
| 7 | SQL Command Matching | Shareable SQL depends on compatible text, environment, object resolution, and other cursor attributes. |
| 8 | Oracle Large Pool | The optional large pool supplies large allocations for selected operations without displacing shared-pool cache entries. |
| 9 | Program Global Area | A PGA is private to one server or background process; the instance PGA is the aggregate of all process PGAs. |
| 10 | Oracle PGA Contents | Private SQL areas, SQL work areas, session-related data, and stack space support process execution. |
| 11 | Oracle Sort Areas | Sort operators use dynamically sized work areas and may spill to temporary storage when memory is insufficient. |
Oracle allocates the SGA when an instance starts and releases it when the instance shuts down. Server and background processes attach to this shared region. The SGA is not the database itself: the database is the persistent collection of files, while an instance is the memory structures and processes that operate the database. Memory accelerates and coordinates access, but durability ultimately depends on persistent storage.
The database buffer cache holds copies of database blocks read from data files. A server process first looks for a usable block in the cache. A logical read can use a cached copy; a physical read brings the required block from storage when necessary. Changes are made to the cached block, producing a dirty buffer. Database writer processes later write dirty buffers to data files under Oracle's write rules. A commit does not require every changed data block to be written immediately; commit durability is primarily established when the required redo reaches persistent online redo storage.
Most blocks use the DEFAULT buffer pool. Administrators can assign appropriate segments to KEEP or RECYCLE pools to isolate particular access patterns. Their names express an intended caching strategy, not an absolute promise: KEEP does not pin every block forever, and RECYCLE does not bypass caching. Extra pools should therefore be based on observed block reuse, cache pressure, and response-time effects rather than on an object label such as “important” or “large.”
The redo log buffer stores redo entries that describe changes. Because recovery must be able to reproduce database changes, redo is fundamental to transaction durability and instance recovery. The Log Writer process (LGWR) writes redo from this circular SGA buffer to the current online redo log in response to commit and other write conditions. The database writer and log writer have different responsibilities: DBWn writes data blocks, whereas LGWR writes the change records needed to recover them.
The shared pool contains structures used during parsing and execution. Its library cache can hold shared SQL and PL/SQL representations, including parsed statement information and execution plans. Its data dictionary cache, also called the row cache, holds frequently needed object, user, privilege, and structural metadata. Reusing suitable cached information can reduce repeated parsing and metadata work, but reuse is governed by correctness. Oracle cannot treat cursors as interchangeable merely because two statements look similar to a person.
SQL text, referenced objects, optimizer environment, security context, data types, and other attributes can affect whether an existing cursor is shareable. Applications should use bind variables when values change but statement structure remains the same. Binds can reduce needless parent cursor proliferation and hard parsing, yet they do not guarantee one child cursor or one plan. Different optimizer requirements can legitimately produce multiple child cursors. Cursor-sharing settings are controls for particular workloads, not substitutes for sound application SQL.
The large pool is an optional area intended for selected large allocations, including shared-server session memory, parallel execution message buffers, and some backup and recovery I/O buffers. It is not a second general-purpose shared pool and it is not managed as a cache of SQL objects. Keeping these allocations separate can prevent them from competing with reusable library-cache and row-cache content.
Depending on configuration and licensed features, an SGA can also include the Java pool, Streams pool, In-Memory Area, and Vector Pool, together with the Fixed SGA and other internal structures. Not every database allocates every optional area. A useful architecture diagram distinguishes core structures from feature-dependent structures instead of implying that every installation has the same SGA layout.
Every Oracle server or background process has a PGA. One PGA is private; it is not accessed as a common cache by other processes. The term instance PGA describes the collective memory used by all process PGAs in the instance, not a separately shared memory structure. Consequently, connection count, concurrent SQL, parallel execution, and background activity can all influence aggregate PGA consumption.
A server-process PGA can contain stack space, private SQL areas, and SQL work areas. A private SQL area stores execution-specific information such as bind values, runtime cursor state, and fetch position. It complements the shared SQL area in the SGA: the shared representation may be reusable, while each execution still needs private state. SQL work areas supply memory for operators such as sorting, hashing, and bitmap merges. These areas can grow and shrink over an execution and are not permanent per-user reservations.
The User Global Area (UGA) contains session state. Its location depends on the connection architecture. With a dedicated server, session memory is normally in the process PGA. With Oracle Shared Server, a session may be serviced by different shared server processes, so its UGA must be placed in shared memory, commonly the large pool when configured and otherwise the shared pool. This placement rule resolves the apparent contradiction between “session memory” and “private process memory”: session lifetime and process lifetime are not always identical.
With WORKAREA_SIZE_POLICY=AUTO, Oracle sizes SQL work areas dynamically within the aggregate PGA framework. An operator executes
optimally when its work fits in available memory. A one-pass execution uses temporary storage and processes the data with one additional pass; a multipass execution requires more passes and usually more temporary I/O. A spill is not automatically an error—large, infrequent operations may reasonably exceed available work memory—but repeated large multipass operations deserve investigation.
PGA_AGGREGATE_TARGET is a target for aggregate PGA management rather than a hard ceiling. PGA_AGGREGATE_LIMIT supplies an
aggregate limit and can trigger Oracle's protective response when consumption becomes excessive. Older settings such as
SORT_AREA_SIZE remain relevant to manual or compatibility scenarios, but they are not the default tuning method for modern automatic
work-area management. The proper unit of diagnosis is the execution-plan operator and workload interval, not a mythical single “sort area” for
an entire user or statement.
A simplified SQL lifecycle connects the individual lessons. Actual executions can include additional caches, background activity, direct-path operations, parallel servers, or feature-specific memory, but the sequence provides a reliable mental model.
This flow also explains why one symptom can cross several components. Excessive hard parsing can consume CPU and shared-pool resources; a poor plan can increase buffer-cache reads and PGA work-area demand; high concurrency can shrink the effective memory available to each work area; inefficient change processing can increase both dirty-buffer activity and redo generation. Tuning one parameter without identifying this chain of cause and effect can move the bottleneck rather than remove it.
Oracle provides multiple management models because deployment environments differ. Select and document one coherent approach for the database. Parameter names should be interpreted as targets, limits, minimums, or explicit component sizes according to their definitions; they are not all interchangeable caps.
| Approach | Principal controls | Meaning |
|---|---|---|
| Unified memory management | MEMORY_SIZE |
Oracle AI Database 26ai can manage a unified memory pool for the instance under supported configurations. |
| Automatic Memory Management | MEMORY_TARGET, MEMORY_MAX_TARGET |
Oracle manages the distribution of memory between the SGA and instance PGA within the configured framework. |
| Automatic Shared Memory Management | SGA_TARGET, SGA_MAX_SIZE, PGA_AGGREGATE_TARGET |
Oracle automatically distributes SGA memory among eligible components while PGA work areas use their aggregate target. |
| Manual component management | Individual cache, pool, and work-area settings | Administrators size more components explicitly; this requires stronger evidence and continued operational attention. |
Feature availability and parameter behavior can depend on platform, deployment, container scope, and database release. A configuration should be checked against the documentation for the installed release and validated under a representative workload. Do not combine recommendations from different management modes without understanding which parameters take precedence and which components remain manually sized.
Memory tuning begins with a measurable workload problem: latency, throughput loss, allocation errors, excessive parsing, unwanted physical I/O, or costly work-area spills. A cache ratio or lifetime counter by itself is not a diagnosis. Establish the affected interval and SQL, inspect the relevant memory and wait evidence, change one justified control, and repeat the same workload comparison.
| Question | Useful starting evidence |
|---|---|
| How is the SGA allocated? | V$SGA, V$SGAINFO, and V$SGASTAT |
| How are buffer pools configured? | V$BUFFER_POOL and segment storage attributes |
| Is parsing or cursor proliferation significant? | V$SQL, V$SQLAREA, cursor statistics, and child-cursor evidence |
| How much PGA is allocated and used? | V$PGASTAT and V$PROCESS_MEMORY |
| Which work areas are active or spilling? | V$SQL_WORKAREA_ACTIVE, V$SQL_WORKAREA_HISTOGRAM, and V$TEMPSEG_USAGE |
| What parameters define the selected policy? | V$PARAMETER or V$SYSTEM_PARAMETER, interpreted in the current container and deployment |
SELECT name, value, unit
FROM v$pgastat
ORDER BY name;
SELECT low_optimal_size,
high_optimal_size,
optimal_executions,
onepass_executions,
multipasses_executions
FROM v$sql_workarea_histogram
ORDER BY low_optimal_size;
These views have different scopes and lifetimes. Some values accumulate since instance startup; some describe current activity; some are estimates or advisory data. Before-and-after snapshots around a representative workload are usually more informative than an isolated total. Multitenant databases also require attention to container scope, and managed services may restrict settings that are available in self-managed installations.
The SGA and PGA are complementary rather than competing concepts. The SGA lets processes cooperate through cached blocks, shared program representations, metadata, redo, and feature-specific areas. The PGA gives each process the isolation required for execution state, session work, and operator memory. The dedicated-versus-shared-server placement of the UGA shows that Oracle chooses a location according to who must access the state and how long it must survive.
Effective administration follows the same logic. First identify whether the affected information should be shared or private. Then identify the responsible component and the SQL or process using it. Finally, measure the full workload before changing a management target, component size, plan, or application behavior. This progression turns memory architecture from a diagram of boxes into a practical model for explaining database behavior and making defensible performance decisions in Oracle AI Database 26ai.
After completing Module 5, you should be able to trace a SQL request across private process state and shared instance structures, distinguish data writes from redo writes, explain why cursor reuse has correctness requirements, describe when a work area spills, and select evidence that tests a tuning hypothesis. Those capabilities are the durable outcome of the module: not memorizing every parameter, but understanding the boundaries, interactions, and measurements that make Oracle memory manageable.