Oracle memory management PGA details

Source: Internet
Author: User

Oracle 10gIn the database, you need to set workarea_size_policy to AUTO, and set the pga_aggregate_target parameter to implementPGAOfMemory Management. Next we will introduce the implementation of this setup process. First, take a look at the following code:

 
 
  1. SQL> show parameter pga    
  2.  
  3. NAME                                 TYPE        VALUE    
  4.  
  5. ------------------------------------ ----------- ------------------------------     
  6.  
  7. pga_aggregate_target                 big integer 169M    
  8.  
  9. SQL> show parameter workarea    
  10.  
  11. NAME                                 TYPE        VALUE    
  12.  
  13. ------------------------------------ ----------- ------------------------------     
  14.  
  15. workarea_size_policy                 string      AUTO    
  16.  
  17. SQL> show parameter pga  
  18.  
  19. NAME                                 TYPE           VALUE  
  20.  
  21. ------------------------------------ ----------- ------------------------------  
  22.  
  23. pga_aggregate_target big  integer           169M  
  24.  
  25. SQL> show parameter workarea  
  26.  
  27. NAME                                TYPE            VALUE  
  28.  
  29. ------------------------------------ ----------- ------------------------------  
  30.  
  31. workarea_size_policy         string            AUTO 

The pga_aggregate_target parameter can be set based on the experience value. A simple method to evaluate the PGA can be used to view the PGA Hit rate (PGA Cache Hit %) in the AWR report ), analyze whether the wait events of direct path read temp and direct path write temp are high. These wait events indicate the waiting events that result in a large number of temporary tablespace operations due to limited parameters set by PGA. Of course, there are also complicated methods to evaluate PGA. Let's take a look later.

Note: For 9I shared server connection, you must explicitly set SORT_AREA_SIZE and HASH_AREA_SIZE, that is, you cannot use the automatic management mode. 10 Gb does not have this restriction.

PGA_AGGREGATE_TARGET is a theoretical maximum value, and PL/SQL is easily exceeded). It is not allocated so much at ORACLE startup, you can even set the size of the production database larger than the physical MEM. Do not set pga_aggregate_target + sga <MEM. Do not challenge the limits of ORACLE ). A session may have multiple sort and hash workareas. Each workarea may use 5% or 100 M at most (controlled by two hidden parameters). Therefore, if each sort is expected, the hash workarea is 5 M, and PGA_AGGREGATE_TARGET should be set to 100 M. However, as the user increases or the workload increases, the capacity of each workarea may be reduced, because there is a limit on the total PGA_AGGREGATE_TARGET, such as 100 workareas, therefore, each instance can only be allocated to 1 MB.

Parallel query uses a maximum of 30% PGA_AGGREGATE_TARGET (controlled by hidden parameters). Each PIECE of parallel query is allocated a corresponding 30%, that is, parallel query may use 30 M and 10 PARALLEL, 3 M for each instance. This is also the reason why auto management is recommended. A system usually uses workload and the session Changes over time. Three users may be in the morning, and 300 users may be in the middle of the day, so fixed sort is used, hash parameters are out of date. automatic Management allows users to allocate more memory when less concurrency occurs. When more concurrency occurs, users can take care of the public and allocate less memory. Since ORACLE 9.2, PGA advisory is available. I do not know whether the 5% and 30% mentioned in this section are correct. I don't have time to read the oracle documentation. I would like to remind myself here.

V $ pgastat:

 
 
  1. SQL> set pagesize 200  
  2.  
  3. SQL> select name||' '|| to_char(decode( unit,  
  4.  
  5. 'bytes', value/1024/1024,  
  6.  
  7. value ),'999,999,999.9')||' '||  
  8.  
  9. decode( unit, 'bytes', 'mbytes', unit   
  10.  
  11. from v$pgastat;  
  12.  
  13. NAME||''||TO_CHAR(DECODE(UNIT,'BYTES',VALUE/1024/1024,VALUE),'999,999,999.9')||''||DECODE(UN  
  14.  
  15. --------------------------------------------------------------------------------------------  
  16.  
  17. aggregate PGA target parameter 169.0 mbytes  
  18.  
  19. aggregate PGA auto target 124.3 mbytes  
  20.  
  21. global memory bound 33.8 mbytes  
  22.  
  23. total PGA inuse 30.9 mbytes  
  24.  
  25. total PGA allocated 65.4 mbytes  
  26.  
  27. maximum PGA allocated 82.2 mbytes  
  28.  
  29. total freeable PGA memory .0 mbytes  
  30.  
  31. process count 24.0  
  32.  
  33. max processes count 33.0  
  34.  
  35. PGA memory freed back to OS .0 mbytes  
  36.  
  37. total PGA used for auto workareas .0 mbytes  
  38.  
  39. maximum PGA used for auto workareas .6 mbytes  
  40.  
  41. total PGA used for manual workareas .0 mbytes  
  42.  
  43. maximum PGA used for manual workareas .0 mbytes  
  44.  
  45. over allocation count .0  
  46.  
  47. bytes processed 23.5 mbytes  
  48.  
  49. extra bytes read/written .0 mbytes  
  50.  
  51. cache hit percentage 100.0 percent  
  52.  
  53. recompute count (total) 817.0 

Several important parameters are described as follows:

The target parameter value of PGA set by aggregate pga target parameter.

In automatic management mode, aggregate PGA auto target can be used in the oracle Workspace.

Total PGA inuse the pga used by the current instance.

Total PGA allocated the pga actually allocated by the current instance.

Maximum PGA allocated can be allocated to the maximum pga.

Over allocation count the PGA allocated by ORACLE exceeds the pga_aggregate_target times. This parameter can be used to determine whether pga_aggregate_target is set too small.

Cache hit percentage the PGA hit rate after the instance is started. If all operations are performed in MEM and not in TEMP, the hit rate should be 100%.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.