Presentation is loading. Please wait.

Presentation is loading. Please wait.

10 Copyright © 2006, Oracle. All rights reserved. Automatic Shared Memory Management.

Similar presentations


Presentation on theme: "10 Copyright © 2006, Oracle. All rights reserved. Automatic Shared Memory Management."— Presentation transcript:

1 10 Copyright © 2006, Oracle. All rights reserved. Automatic Shared Memory Management

2 Copyright © 2006, Oracle. All rights reserved. 10-2 Objectives After completing this lesson, you should be able to do the following: Enable Enterprise Manager (EM) memory parameters Set auto-tuned memory parameters Override minimum size with the manually tuned SGA parameters Use the SGA advisor to set SGA_TARGET

3 Copyright © 2006, Oracle. All rights reserved. 10-3 Spfile Temp Data file Undo Oracle Database Architecture PMON SMON RECO MMON MMNL PSP0 MMANDBWnLGWR CKPT CJQ0 S000 D000 QMNC Qnnn FMON ARCn CTWR RVWR Fixed size Large pool Java pool Streams pool Default buffer cache Keep buffer cache Recycle buffer cache nK buffer caches Redo log buffer ASH buffer Sort extent pool Global context pool SGA Flash back buffer Instance Flashback logs Redo log files Archive log files Control files SYSTEM SYSAUX Change tracking file Password file Shared pool

4 Copyright © 2006, Oracle. All rights reserved. 10-4 Dynamic SGA Feature Implements an infrastructure to allow the server to change its SGA configuration without shutting down the instance SGA size is limited by SGA_MAX_SIZE : –Used for reserving virtual memory address space at instance startup –Cannot be changed dynamically Allows for certain SGA components to be dynamically resized SELECT bytes FROM V$SGAINFO WHERE name = 'Free SGA Memory Available';

5 Copyright © 2006, Oracle. All rights reserved. 10-5 Granule SGA memory is allocated in units of contiguous memory chunks called granules. The size of a granule depends on the estimated total SGA. If the estimated SGA size is: –Less than or equal to 1 GB, the granule size is 4 MB –Greater than 1 GB, the granule size is 16 MB SELECT bytes FROM V$SGAINFO WHERE name = 'Granule Size';

6 Copyright © 2006, Oracle. All rights reserved. 10-6 Memory Advisories Buffer Cache Advice (introduced in 9 i R1): – V$DB_CACHE_ADVICE –Predicts physical reads for different cache sizes Shared Pool Advice (in 9 i R2): – V$SHARED_POOL_ADVICE –Predicts parse time savings from having different sizes of the shared pool Java Pool Advice (in 9 i R2): – V$JAVA_POOL_ADVICE –Predicts Java class load time savings from having different sizes of Java pool Streams Pool Advice (10g R2) – V$STREAMS_POOL_ADVICE –Predicts spill and unspill activity for various sizes

7 Copyright © 2006, Oracle. All rights reserved. 10-7 Manually Adding Granules to Components Use the ALTER SYSTEM command to dynamically increase memory allocation to a component. Increasing the memory use of a component succeeds only if there are enough free granules to satisfy the request. Memory granules are not freed automatically from another component to satisfy the increase. Decreasing the size of a component is possible, but only if the granules being released are unused by the component.

8 Copyright © 2006, Oracle. All rights reserved. 10-8 Increasing the Size of an SGA Component SQL> show parameter NAME TYPE VALUE ------------- ----------- ----------------------- sga_max_size big integer 200M shared_pool_size big integer 84M db_cache_size big integer 92M SQL> alter system set shared_pool_size=120M; alter system set shared_pool_size=120M * ERROR at line 1: ORA-02097: parameter cannot be modified … ORA-04033: Insufficient memory to grow pool SQL> alter system set db_cache_size=50M; System altered. SQL> alter system set shared_pool_size=120M; System altered.

9 Copyright © 2006, Oracle. All rights reserved. 10-9 Automatic Shared Memory Management: Overview Uses dynamic SGA and memory advisors to automatically adapt to workload changes Maximizes memory utilization Helps eliminate out-of-memory errors Avoids relearning when using SPFILE Online usersBatch jobs Buffer cache Large pool Shared pool Java pool Buffer cache Large pool Shared pool Java pool Online usersBatch jobs Streams pool

10 Copyright © 2006, Oracle. All rights reserved. 10-10 SGA Sizing Parameters: Overview With ASMM, five important SGA components can be automatically sized. Nondefault buffer pools are not auto-tuned. Log buffer is not a dynamic component but has a good default. DB_KEEP_CACHE_SIZE DB_RECYCLE_CACHE_SIZE DB_ n K_CACHE_SIZE LOG_BUFFER_SIZE SHARED_POOL_SIZE DB_CACHE_SIZE LARGE_POOL_SIZE JAVA_POOL_SIZE STREAMS_POOL_SIZE Auto-tuned parameters Manual dynamic parameters Manual static parameters SGA_TARGET SGA_MAX_SIZE

11 Copyright © 2006, Oracle. All rights reserved. 10-11 Benefits of Automatic Shared Memory Management DB_CACHE_SIZE SHARED_POOL_SIZE LARGE_POOL_SIZE JAVA_POOL_SIZE STREAMS_POOL_SIZE Total SGA size SGA_TARGET

12 Copyright © 2006, Oracle. All rights reserved. 10-12 Dynamic SGA Transfer Modes ASMM IMMEDIATE transfer mode: –Out-of-memory ( ORA-04031 ) errors –Partial granules can be used. ASMM DEFERRED transfer mode: –Transparently executed in the background –Partial granules can be used. MANUAL transfer mode: –Used with ALTER SYSTEM commands –Resize must use full granules.

13 Copyright © 2006, Oracle. All rights reserved. 10-13 Memory Broker Architecture Statistic deltas across different time periods Circular SGA buffer of stats captured by MMON Memory Broker Policy Module Add two granules to shared pool. Output: resize requests Trade-off different components benefit/lost MMAN transfers the memory. resize queue MMAN MMON

14 Copyright © 2006, Oracle. All rights reserved. 10-14 Manually Resizing Dynamic SGA Parameters For auto-tuned parameters, manual resizing: –Results in immediate component resize if the new value is greater than the current size –Changes the minimum size if the new value is smaller than the current size Manually tuned parameter resizing affects the tunable portion of the SGA.

15 Copyright © 2006, Oracle. All rights reserved. 10-15 Behavior of Auto-Tuned SGA Parameters When SGA_TARGET is not set or is set to zero: –Auto-tuned parameters are explicitly set –Note: SHARED_POOL_SIZE Internal startup overhead is included Value may need to be increased from previous releases When SGA_TARGET is set: –Default value of auto-tuned parameters is zero –A nonzero value is a lower bound –Current values in megabytes are shown by: SELECT component, current_size/1024/1024 FROM V$SGA_DYNAMIC_COMPONENTS;

16 Copyright © 2006, Oracle. All rights reserved. 10-16 Behavior of Manually Tuned SGA Parameters Manually tuned components are: – KEEP and RECYCLE buffer caches –Nondefault block size caches – LOG_BUFFER Manually tuned components are user specified. Manually tuned components are included in SGA_TARGET to precisely control the SGA size.

17 Copyright © 2006, Oracle. All rights reserved. 10-17 Using the V$PARAMETER View SGA_TARGET = 8G SELECT name, value, isdefault FROM V$PARAMETER WHERE name LIKE '%size'; DB_CACHE_SIZE = 0 JAVA_POOL_SIZE = 0 LARGE_POOL_SIZE = 0 SHARED_POOL_SIZE = 0 STREAMS_POOL_SIZE = 0

18 Copyright © 2006, Oracle. All rights reserved. 10-18 Resizing SGA_TARGET The SGA_TARGET initialization parameter: –Is dynamic –Can be increased up to SGA_MAX_SIZE –Can be reduced until all components reach minimum size –Changes affect only automatically sized components Includes everything in the SGA: –Fixed SGA and other internal allocations –Automatically sized SGA components –Manual SGA components Allows precise sizing of the total shared memory allocation by the Oracle server

19 Copyright © 2006, Oracle. All rights reserved. 10-19 SGA size = 8 GB Disabling Automatic Shared Memory Management Setting SGA_TARGET to zero disables auto-tuning. Auto-tuned parameters are set to their current sizes. SGA size as a whole is unaffected. Parameters: SGA_TARGET = 8G SHARED_POOL_SIZE=1G Parameters: SGA_TARGET = 0 DB_CACHE_SIZE = 4G SHARED_POOL_SIZE = 1.5G LARGE_POOL_SIZE = 512M JAVA_POOL_SIZE = 512M STREAMS_POOL_SIZE = 512M SGA size = 8 GB Original values SGA_TARGET=0

20 Copyright © 2006, Oracle. All rights reserved. 10-20 Configuring ASMM

21 Copyright © 2006, Oracle. All rights reserved. 10-21 SGA Advisor

22 Copyright © 2006, Oracle. All rights reserved. 10-22 Monitoring ASMM Monitor Automatic Shared Memory Management and examine the resize decisions it made with the following views: V$SGA_CURRENT_RESIZE_OPS : Information about resize SGA operation in progress V$SGA_RESIZE_OPS : Circular history buffer of the last 800 SGA resize requests V$SGA_DYNAMIC_COMPONENTS : Current status of all memory components V$SGA_DYNAMIC_FREE_MEMORY : Information about SGA memory available for future resize operations

23 Copyright © 2006, Oracle. All rights reserved. 10-23 Practice: Overview This practice covers the following topics: Enable Automatic Shared Memory Management Adjust memory as workloads change

24 Copyright © 2006, Oracle. All rights reserved. 10-24 Summary In this lesson, you should have learned how to: Enable EM memory parameters Set auto-tuned memory parameters Set the manually tuned SGA parameters Use the SGA advisor to set SGA_TARGET


Download ppt "10 Copyright © 2006, Oracle. All rights reserved. Automatic Shared Memory Management."

Similar presentations


Ads by Google