What Is Automatic Shared Memory Management?


Until Oracle 9i, the Oracle server allotted the required memory for fixed SGA and other internal allocations. The common problems with improper SGA sizing are undersized memory, leading to poor performance and out-of-memory errors (ORA-4031); and oversized memory, leading to wasted memory and latch contention. This scenario has changed with the introduction of Automatic Shared Memory Management, which is described in the following paragraphs.

Automatic Shared Memory Management (ASMM) is the new manageability feature that enables Oracle Database 10g to automatically determine the appropriate values for SGA components within the total size limits of SGA. The commonly tuned SGA components are the database buffer cache, the shared pool, the large pool, and the Java pool. These initialization parameters are referred to as auto-tuned SGA parameters.

In Oracle Database 10g, the DBA can assign the total amount of SGA available to an instance with the SGA_TARGET initialization parameter. Oracle database automatically distributes this memory among its various subcomponents for the most effective memory utilization. The SGA_TARGET parameter includes all SGA memory, including automatically sized components, manually sized components, and internal allocations during the database startup. Log buffer, other buffer caches (for example, recycle and keep), fixed SGA, and internal allocations are considered manually sized components in Oracle Database 10g. The default value for SGA_TARGET parameter is 0, with ASMM being disabled.

The SGA is made up of pools of memory such as the shared pool, java pool, buffer cache, and so on. These SGA components allocate and deallocate space in measurement units of granules. The granule size is determined by the total SGA size. As a generalization, for most platforms with total SGA size equal to or less than 1GB, granule size is 4MB. Granule size is usually 16MB (8MB for Windows) for SGAs larger than 1GB. Some platform dependencies may arise. Refer to your operating systemspecific documentation for more details. The granule size can be identified from the V$SGAINFO view. All dynamic components in the SGA have the same granule size.

If you specify the size of a SGA component at a value different from a multiple of its granule size, Oracle Database will round the specified size up to the nearest higher multiple. If the granule size is 16MB and you specify DB_CACHE_SIZE as 30MB, for example, the database will actually allocate 32MB.

Significance of the STATISTICS_LEVEL Parameter

Oracle Database collects database-level statistics and operating-system statistics for various reasons, including for self-management decisions. STATISTICS_LEVEL is the initialization parameter that determines the level of collection of these statistics. It can accept TYPICAL, ALL, or BASIC as inputs. A value of TYPICAL collects all major statistics required for database self-management and provides the best overall performance for most environments. ALL collects additional statistics like timed operating system statistics and execution plan statistics. BASIC disables the collection of many important statistics including automatic SGA, shared pool, buffer cache, and PGA target advisory statistics, which are discussed in this chapter. This setting is not at all recommended for a self-tuned database.


To use ASMM, STATISTICS_LEVEL must be set to TYPICAL (default) or ALL. You can query the V$STATISTICS_LEVEL view to get more information on the status of the statistics controlled by the STATISTICS_LEVEL parameter.

When ASMM is enabled in the database, the sizes of various SGA components are flexible. They resize among themselves to adapt to the workload needs without any additional DBA intervention. The database will automatically distribute the SGA among the various components as needed, maximizing the consumption of all available memory. If the manually tuned parameters are set, they consume their memory from SGA_TARGET, leaving remaining memory for automatically tuned components as listed in Table 5.1.

Table 5.1. SGA Components and Corresponding Initialization Parameters

Type of Tuning

SGA Component

Initialization Parameter

Automatic

Fixed SGA and related internal allocations

Not applicable

Automatic

Buffer cache

DB_CACHE_SIZE

Automatic

Shared pool

SHARED_POOL_SIZE

Automatic

Large pool

LARGE_POOL_SIZE

Automatic

Java pool

JAVA_POOL_SIZE

Automatic

Streams pool

STREAMS_POOL_SIZE

Manual

Log buffer

LOG_BUFFER

Manual

Keep buffer cache

DB_KEEP_CACHE_SIZE

Manual

Recycle buffer cache

DB_RECYCLE_CACHE_SIZE

Manual

Nonstandard block size buffer caches

DB_nK_CACHE_SIZE where n= (2, 4, 8, 16, 32)


With automatic SGA management enabled, Oracle's internal tuning algorithm continuously monitors the workload performance and increases the shared pool as needed to reduce the number of parses. It increases the value in small chunks over time until the optimal size is reached, but does not shrink it back. The presence of open cursors, pinned PL/SQL packages, and other SQL execution states in the shared pool make it impossible to find granules that can be freed. With manual configuration, compiled SQL statements may frequently age out of the shared pool with inadequate size.

ASMM with Unsupported Initialization Parameters

If your database instance startup failed with ORA-00824, review this sidebar carefully. If you have upgraded a database but have not removed all deprecated and unsupported parameters in the initSID.ora file, you will get this error. On Oracle Database 10g, if you enable automatic SGA management by setting the SGA_TARGET parameter to a value greater than 0 and retain the DB_BLOCK_BUFFERS parameter in the initSID.ora file, you will encounter ORA-00824. You should carefully edit the initialization parameter file and get rid of all unsupported parameters. Use DB_CACHE_SIZE parameter instead of DB_BLOCK_BUFFERS parameter. If you are unable to fix the parameters, disable ASMM by setting SGA_TARGET=0.


SGA Sizing Considerations

The DBA can control the size of the automatically tuned SGA components by specifying minimum values for the components. This is helpful when an application needs a minimum amount of memory in order for specific components to work properly. You can query the V$SGA_DYNAMIC_COMPONENTS and V$SGAINFO views to get the current actual size of each SGA component, or get this information from the OEM memory configuration page.

When SGA_TARGET is resized, automatically tuned components (without a set minimum value) are affected by the operation. All manually tuned components remain unaffected.

When enabling Automatic Shared Memory Management, it is best to set SGA_TARGET to the desired non-zero value before starting the database. Dynamically modifying SGA_TARGET from zero to a non-zero value may not achieve the desired results because the shared pool may not be able to shrink. After startup, you can dynamically tune SGA_TARGET up or down as required.

We discussed the new Memory Manager (MMAN) background process used by ASMM, in Chapter 1, "Exploring Oracle Database 10g Structure." The MMAN background process coordinates the sizing of the memory components and acts as a memory broker. It keeps track of all memory components and their pending resize operations.

You can use the following V$ views to get more information about SGA components and their dynamic resizing:

  • V$SGA gives summary information about the system global area (SGA).

  • V$SGAINFO gives information about SGA size, including the different SGA components, the granule size, and free memory.

  • V$SGASTAT gives detailed information about the SGA in terms of memory/space distribution and usage.

  • V$SGA_DYNAMIC_COMPONENTS gives information about the dynamic SGA components.

  • V$SGA_DYNAMIC_FREE_MEMORY gives information on SGA memory available for future dynamic SGA resize operations.

  • V$SGA_RESIZE_OPS gives information about the last 400 completed SGA resize operations.

  • V$SGA_CURRENT_RESIZE_OPS gives information about SGA resize operations that are currently in progress.

  • V$SGA_TARGET_ADVICE gives helpful information to tune SGA_TARGET.



    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