Sizing the Shared Pool pdf

38 338 0
Sizing the Shared Pool pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

4 Sizing the Shared Pool Copyright © Oracle Corporation, 2002 All rights reserved Objectives After completing this lesson, you should be able to the following: • Determine the size of an object and pin it in the shared pool • Tune the shared pool reserved space • Describe the user global area (UGA) and session memory considerations • Measure the library cache hit ratio • List other tuning issues related to the shared pool • Measure the dictionary cache hit ratio • Set the large pool 4-2 Copyright © Oracle Corporation, 2002 All rights reserved Shared Pool Contents Major components of the shared pool are: • Library cache • Data dictionary cache • User global area (UGA) for shared server sessions Database buffer cache Redo log buffer Shared pool Library cache UGA Data dictionary cache User global area 4-3 Large pool Copyright © Oracle Corporation, 2002 All rights reserved Shared Pool • • • • Defined by SHARED_POOL_SIZE Library cache contains statement text, parsed code, and execution plan Data dictionary cache contains definitions for tables, columns, and privileges from the data dictionary tables UGA contains session information for Oracle Shared Server users when a large pool is not configured Shared pool Library cache Shared pool Shared pool Data dictionary cache UGA 4-4 Copyright © Oracle Corporation, 2002 All rights reserved The Library Cache • • • 4-5 Used to store SQL statements and PL/SQL blocks to be shared by users Managed by a least recently used (LRU) algorithm Used to prevent statements reparsing Copyright © Oracle Corporation, 2002 All rights reserved The Library Cache Shared SQL, PL/SQL areas Context area for SELECT statement Context area for SELECT statement SELECT statement 4-6 SELECT statement SELECT statement Copyright © Oracle Corporation, 2002 All rights reserved Important Shared Pool Latches • • 4-7 shared pool: Protects memory allocations in the shared pool library cache: Locates matching SQL in the shared pool Copyright © Oracle Corporation, 2002 All rights reserved Shared Pool and Library Cache Latches Contention for shared pool latch and library cache latch indicates one or more of the following: • Unshared SQL • Reparsed sharable SQL • Insufficiently sized library cache 4-8 Copyright © Oracle Corporation, 2002 All rights reserved Tuning the Library Cache Reduce misses by keeping parsing to a minimum: • Make sure that users can share statements • Prevent statements from being aged out by allocating enough space • Avoid invalidations that induce reparsing 4-9 Copyright © Oracle Corporation, 2002 All rights reserved Tuning the Library Cache Avoid fragmentation by: • Reserving space for large memory requirements • Pinning frequently required large objects • Eliminating large anonymous PL/SQL blocks • Enabling the use of large pool for Oracle Shared Server connections 4-10 Copyright © Oracle Corporation, 2002 All rights reserved Large Memory Requirements • • Satisfy requests for large contiguous memory Reserve contiguous memory within the shared pool Shared pool v$shared_pool_reserved Library cache Shared SQL and PL/SQL SHARED_POOL_SIZE SHARED_POOL_RESERVED_SIZE Data dictionary cache UGA 4-28 Copyright © Oracle Corporation, 2002 All rights reserved Tuning the Shared Pool Reserved Space • Diagnostic tools for tuning: – The v$shared_pool_reserved dictionary view – The supplied aborted_request_threshold procedure in the dbms_shared_pool package • 4-30 Guidelines: Set the SHARED_POOL_RESERVED_SIZE parameter Copyright © Oracle Corporation, 2002 All rights reserved Keeping Large Objects Find those PL/SQL objects that are not kept in the library cache: SQL> SELECT * FROM v$db_object_cache WHERE sharable_mem > 10000 AND (type='PACKAGE' OR type='PACKAGE BODY' OR type='FUNCTION' OR type='PROCEDURE') AND kept='NO'; Pin large packages in the library cache: SQL> EXECUTE dbms_shared_pool.keep(‘package_name’); 4-32 Copyright © Oracle Corporation, 2002 All rights reserved Anonymous PL/SQL Blocks Find the anonymous PL/SQL blocks and convert them into small anonymous PL/SQL blocks that call packaged functions: SQL> SELECT sql_text FROM v$sqlarea WHERE command_type = 47 AND length(sql_text) > 500; 4-34 Copyright © Oracle Corporation, 2002 All rights reserved Other Parameters Affecting the Library Cache • • • • 4-36 OPEN_CURSORS CURSOR_SPACE_FOR_TIME SESSION_CACHED_CURSORS CURSOR_SHARING Copyright © Oracle Corporation, 2002 All rights reserved Tuning The Data Dictionary Cache Use v$rowcache to obtain information about the data dictionary cache • Content: Definitions of dictionary objects • Terminology: – gets: Number of requests on objects – getmisses: Number of requests resulting in cache misses • 4-38 Tuning: Avoid dictionary cache misses Copyright © Oracle Corporation, 2002 All rights reserved Diagnostic Tools for Tuning the Data Dictionary Cache Shared pool Library cache v$rowcache: parameter gets getmisses Shared SQL and PL/SQL Data dictionary cache UGA SHARED_POOL_SIZE 4-39 Copyright © Oracle Corporation, 2002 All rights reserved Sp_1_2.lst Measuring the Dictionary Cache Statistics In the Dictionary Cache Stats section of Statspack: • Percent misses should be very low: – < 2% for most data dictionary objects – < 15% for the entire data dictionary cache • • 4-40 Cache Usage is the number of cache entries being used Pct SGA is a percentage of usage to allocated size for that cache Copyright © Oracle Corporation, 2002 All rights reserved Tuning the Data Dictionary Cache Keep the percentage of the sum of getmisses to the sum of gets less than 15%: SQL> SELECT parameter, gets, getmisses FROM v$rowcache; PARAMETER GETS GETMISSES - dc_objects 143434 171 dc_synonyms 140432 127 4-42 Copyright © Oracle Corporation, 2002 All rights reserved Guidelines: Dictionary Cache Misses Statspack report output: (font size incorrect) Get Cache Requests Pct Miss Scan Reqs Pct Mod Miss Reqs Final Usage Pct SGA - - - - -dc_free_extents 0 3 dc_histogram_defs 11 0.0 0 49 92 dc_object_ids 19 0.0 0 440 98 If there are too many cache misses, increase the SHARED_POOL_SIZE parameter 4-43 Copyright © Oracle Corporation, 2002 All rights reserved Performance Manager: Shared Pool Statistics 4-44 Copyright © Oracle Corporation, 2002 All rights reserved UGA and Oracle Shared Server Dedicated server configuration PGA Stack space Shared pool UGA User Cursor session state data Shared server configuration Shared pool or large pool v$statname v$sesstat v$mystat 4-45 UGA User Cursor session state data PGA Stack space OPEN_CURSORS SESSION_CACHED_CURSORS Copyright © Oracle Corporation, 2002 All rights reserved Determining the User Global Area Size UGA space used by your connection: SQL> SELECT SUM(value) ||'bytes' "Total session memory" FROM v$mystat, v$statname WHERE name = 'session uga memory' AND v$mystat.statistic# = v$statname.statistic#; UGA space used by all Oracle Shared Server users: SQL> SELECT SUM(value) ||'bytes' "Total session memory" FROM v$sesstat, v$statname WHERE name = 'session uga memory' AND v$sesstat.statistic# = v$statname.statistic#; Maximum UGA space used by all users: SQL> 4-46 SELECT SUM(value) ||'bytes' "Total max memory" FROM v$sesstat, v$statname WHERE name = 'session uga memory max' AND v$sesstat.statistic# = v$statname.statistic#; Copyright © Oracle Corporation, 2002 All rights reserved Large Pool • Can be configured as a separate memory area in the SGA, used for memory with: – – – – • • I/O server processes: DBWR_IO_SLAVES Backup and restore operations Session memory for the shared servers Parallel query messaging Used to avoid performance overhead caused by shrinking the shared SQL cache Sized by the parameter LARGE_POOL_SIZE Database Redo buffer cache log buffer Shared pool Large pool Library cache Data dictionary cache User global area 4-47 Copyright © Oracle Corporation, 2002 All rights reserved Summary In this lesson, you should have learned how to: • Size shared SQL and PL/SQL areas (library cache) • Size data dictionary cache or row cache • Size the large pool • Allow for the user global area, if using Oracle Shared Server connections 4-48 Copyright © Oracle Corporation, 2002 All rights reserved ... memory Reserve contiguous memory within the shared pool Shared pool v $shared_ pool_ reserved Library cache Shared SQL and PL/SQL SHARED_ POOL_ SIZE SHARED_ POOL_ RESERVED_SIZE Data dictionary cache... rights reserved Important Shared Pool Latches • • 4-7 shared pool: Protects memory allocations in the shared pool library cache: Locates matching SQL in the shared pool Copyright © Oracle Corporation,... Tuning the Shared Pool Reserved Space • Diagnostic tools for tuning: – The v $shared_ pool_ reserved dictionary view – The supplied aborted_request_threshold procedure in the dbms _shared_ pool package

Ngày đăng: 15/03/2014, 17:20

Từ khóa liên quan

Mục lục

  • Sizing the Shared Pool

  • Objectives

  • Shared Pool Contents

  • Shared Pool

  • The Library Cache

  • Slide 6

  • Important Shared Pool Latches

  • Shared Pool and Library Cache Latches

  • Tuning the Library Cache

  • Slide 10

  • Terminology

  • Diagnostic Tools for Tuning the Library Cache

  • Are Cursors Being Shared?

  • Sharing Cursors

  • Guidelines: Library Cache Reloads

  • Invalidations

  • Sizing the Library Cache

  • Shared Pool Advisory

  • Oracle Enterprise Manager Shared Pool Size Advisor

  • Cached Execution Plans

Tài liệu cùng người dùng

Tài liệu liên quan