Memory Architecture


The important memory structures associated with an Oracle database instance are the System Global Area (SGA) and the Program Global Area (PGA). As you know, an Oracle instance is made up of SGA and Oracle processes. Oracle allocates memory for the SGA on database startup and returns the memory when the instance is shut down. The size of the SGA is controlled by the sga_max_size initialization parameter in the initInstance.ora file or the server parameter (SPFILE) file.

System Global Area (SGA)

The System Global Area (SGA) is a group of shared memory structures in the Oracle database instance that has the data and control information for the instance. When multiple users are connected to the same database instance, the SGA information is shared by all of them. The SGA is also called "Shared Global Area" for this reason.

The SGA has the following data structures:

  • Database buffer cache. The portion of System Global Area that holds copies of data blocks read from data files. All concurrent user processes share access to the database buffer cache, the size of which is set by the initialization parameter file db_block_size (2KB to 32KB). This size determines a cache hit or miss. Oracle database supports multiple block sizes, whose sizes and numbers are specified by the following parameters: DB_2K_CACHE_SIZE, DB_4K_CACHE_SIZE, DB_8K_CACHE_SIZE, DB_16K_CACHE_SIZE, and DB_32K_CACHE_SIZE. If the cache size is sufficiently large, a request for data is very likely to find the required information, resulting in a cache hit.

  • Redo log buffer. A circular buffer in the SGA that holds information on changes made to the database in the form of redo entries. The LGWR process writes the redo log buffer to the active redo log file (or redo group on disk).

  • Shared pool. Contains the library cache, the dictionary cache, buffers for parallel execution, and control structures. The shared pool size is determined by the shared_pool_size parameter.

  • Java pool. Used in memory for all session-specific java code and data within the Java Virtual Machine (JVM). The Java pool advisor has the information on Java pool size, which can affect the parse rate.

  • Large pool. A large optional memory area used to provide memory allocations for memory requests larger than the size of the shared pool. Memory management of the large pool is not subject to normal LRU algorithms as with shared pool. The sessions themselves deallocate the memory chunks after usage. A large pool can only hold certain types of memory components like RMAN, PQ slaves, and UGA memory if MTS/shared server is used.

  • Data dictionary cache (or row cache). A special location in memory to hold data dictionary data. It is a collection of database tables and views containing reference information about the database, database structures, and database users. Row cache holds the definitions of the tables, views, and related dictionary objects and those definitions are protected by row cache latches. Contrary to normal buffer cache algorithms, the dictionary cache caches in rows, where as buffer cache caches in blocks. This is the major difference between buffer cache and dictionary cache. Hence we call database dictionary cache as row cache.

  • Streams pool. Controls the Streams memory.

How Does SGA Handle the Memory?

The part of SGA that has information about the database and its instance is called fixed SGA. All SGA components allocate and deallocate memory in units called granules. The size of a granule is determined by the total SGA size and its operating system. The size of the SGA is determined by the following initialization parameters, given in the order of relevance:

  • DB_CACHE_SIZE. Size of the cache of standard blocks.

  • LOG_BUFFER. Number of bytes allocated for the redo log buffer.

  • SHARED_POOL_SIZE. Size in bytes of the area for shared SQL and PL/SQL.

  • LARGE_POOL_SIZE. Size of the large pool. The default is 0.

  • JAVA_POOL_SIZE. Size of the Java pool.

  • DB_nK_CACHE_SIZE. Size of nondefault block size cache.

Before Oracle Database 10g, DBAs had to manually specify different SGA component sizes by setting the preceding parameters. In Oracle Database 10g, you can dynamically set these values using the Automatic Shared Memory Management feature (see Chapter 5, "Using Automatic Memory Management," for more details).

Program Global Area (PGA)

Program global area (PGA) is that part of memory that has data and control information for a server process. PGA access is exclusive to the server processes and its application code. The PGA memory can be classified into Private SQL Area, Cursors, and Session Memory.

Memory Manager (MMAN)

MMAN stands for Memory Manager, the new background process used by the Automatic Shared Memory Management feature. MMAN acts as the SGA memory broker and coordinates the size of various memory components within the allowable limits. It also tracks the sizes of the memory components and tracks pending resize operations. You will learn more about the Automatic Shared Memory Management feature in Chapter 5.



    Oracle Database 10g Insider Solutions
    SUSE LINUX Enterprise Server 9 Administrators Handbook
    ISBN: 672327910
    EAN: 2147483647
    Year: 2006
    Pages: 214

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net