当前位置:网站首页>Oracle ASMM and AMM

Oracle ASMM and AMM

2022-06-26 14:26:00 Full stack programmer webmaster

Hello everyone , I meet you again , I'm your friend, Quan Jun .

ASMM(Automatic Shared Memory Management, Automatic shared memory management ) yes Oracle 10g Concepts introduced . By using ASMM, There is no need to manually set the size of the relevant memory components , Just for the sake of SGA Set a total size ,

Oracle Of MMAN process (Memory Manager Process, Memory management process ) Over time , According to the change of system load and memory requirement , Automatic adjustment SGA Memory size of each component in . ASMM Of SGA The components and corresponding parameters contained in are shown in the following table :

stay

MOS SGA and PGA Management in 11g’s Automatic Memory Management (AMM) (ID 1392549.1)AMMASMM every last Oracle All beginners will come into contact with SGA/PGA Knowledge , If from 10g Start learning so much or less will be good for ASMM Know something about , From the perspective of use ASMM It greatly simplifies the process Oracle Setting of memory initialization parameters , stay ASMM The use of advanced DBA It's not much different from beginners ; A lot of people think that ASMM Greatly reduce the database for professional DBA Dependence : If we have a smart enough DB, So why spend money on hiring DBA Well ? This seems to be a very popular idea nowadays . Of course, I can't agree with this idea ,ASMM To a certain extent, it brings convenience , More of a black box , There are many secrets in the black box , These secrets bring more uncertainty than manual management ; stay 10g release 1 and 10.2 In an earlier version ASMM It's kind of like a troublemaker , The other is to let users know ASMM The reason I don't like to see you is ASMM It's slowing down startup The speed of . One personal view is that ASMM Good AMM Let it be , All require a product database DBA Master more SGA/PGA Only with relevant knowledge can we succeed ” Control ” these ” There's intelligence ” The guy who , It's an exaggeration to say that at this time DBA It's very much like a chemist( Need to talk to a lot of people to 1 Or 2 Dealing with strange parameters starting with an underline ).

Oracle Of SGA Basic memory components from 9i It didn't change very much at first , They include :

  • stay 9i Has not yet been introduced in ASMM, The only option is to manage it manually SGA, Sometimes it's called MSMM. stay 9i Remove from buffer cache The size of can be modified manually , The rest of the components cannot be dynamically modified . Because of the lack of a dynamic management mechanism , So in 9i If there is an urgent need for a memory area in the , We can't donate some from other components with free memory to solve the urgent problem .
  • Individual components such as shared pool、default buffer pool There is an optimal size for , But you can't exchange memory between components
  • stay 9i A variety of memory suggestions are provided in (advisor), But both require manual intervention
  • Unable to adapt to changing workloads
  • It often leads to a waste of memory , There's no real use
  • If it's not set properly , The famous ORA-04031 The possibility of error is greatly increased
  • Fully automated shared memory management
  • There is no need to configure each memory component size parameter
  • Use only one parameter sga_target drive
  • Efficient use of all available memory , Greatly reduce memory waste
  • contrast MSMM Its memory management mode :
    • More dynamic
    • More flexible
    • And adaptable
  • Easy to use
  • Enhanced performance to some extent , Because memory allocation is more reasonable
  • When a component needs more memory, it can effectively provide , So it can be avoided to some extent ORA-04031 Happen

ASMM The next part of the parameters are set automatically (Automatically set), These parameters include :shared_pool_size、db_cache_size、java_pool_size、large_pool _size and streams_pool_size; Other static parameters need to be set manually , It includes :db_keep_cache_size、db_recycle_cache_size、db_nk_cache_size、log_buffer And fixing SGA Memory structure, etc , If the above parameters are not set manually , remove log_buffer and fixed sga The default size of other memory components is zero .

SQL> show parameter sga NAME TYPE VALUE ———————————— ———– —————————— lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 2000M sga_target big integer 2000M SQL> show parameter sga_target NAME TYPE VALUE ———————————— ———– —————————— sga_target big integer 2000M SQL> alter system set statistics_level=BASIC; alter system set statistics_level=BASIC * ERROR at line 1: ORA-02097: parameter cannot be modified because specified value is invalid ORA-00830: cannot set statistics_level to BASIC with auto-tune SGA enabled

G10R2.__db_cache_size=973078528 G10R2.__java_pool_size=16777216 G10R2.__large_pool_size=16777216 G10R2.__shared_pool_size=1006632960 G10R2.__streams_pool_size=67108864

stay ASMM There are three types of components in the memory exchange model of

Immediate memory application (Immediate Request): This kind of application mode generally appears in ASMM A managed auto tuning component cannot be allocated to contiguous available memory blocks (chunk) when , In order to avoid OUT-OF-MEMORY(ORA-04031) Error of , The system tries to transfer a memory grain from other candidate components (granule) To come over . It's important to note that there may not be any empty spaces available at the moment granule, There will be an incomplete transfer , In this case, the system will start to clean up the memory particles from the candidate components to meet the memory request , And will be one granule Incomplete transfer to memory critical components .

Manual memory application (Manual Request): This kind of application only occurs when the user uses alter system Command to manually adjust the size of memory components . In this mode, only empty memory particles are allowed to participate in the sizing . If there wasn't enough space granule, So for components grow The operation will return to ORA-4033 error , And for components shrink The operation will return to ORA-4034 error .

When ASMM When enabled , Memory agent (Memory Broker) Perform the activities shown above on a regular basis . All of the above operations are in delayed memory application mode (Deferred). The goal is to tune auto tuning components through automated jobs (auto-tunable component) To adapt to changing workloads , Allocate memory where it is most needed .MMON The worker process will continuously capture statistics and memory suggestions to the recycled memory in the background , And calculate the difference between cache information in different periods ;MMON It will also be based on Memory Broker The strategy to analyze these differences and estimate the long-term and short-term trends . Last MMON Based on the above analysis, some memory component sizing decisions are generated and the corresponding applications are sent to a system application queue (resize request system queue).MMAN Background processes (Memory Manager is a background process that manages the dynamic resizing of SGA memory areas as the workload increases or decreases) Periodically scans the system application queue and performs memory transfers .

When a component acts as a donor (Donor, Below trace Will see in the ) Role time , It could be an incomplete granule Transfer to buffer cache, Then it's time to granule Before being used, you need to complete the following steps :

  • Now let's look at the basic principles of memory transfer , When will buffer cache Medium granule Transfer to shared pool when , The following steps will be followed :
  • In practice ASMM Affected by many hidden parameters , The main parameters are :

Level

Contents

0x01

Enables statistics tracing

0x02

Enables policy tracing

0x04

Enables transfer of granules tracing

0x08

Enables startup tracing

0x10

Enables tuning tracing

0x20

Enables cache tracing

Next, we set up _memory_management_tracing Hide parameters and DUMP_TRANSFER_OPS Dump to learn about a complete memory transfer , And incomplete memory transfers . The following demonstration is complete trace Files can be downloaded from here mman_trace transfer_ops_dump .

Here's a complete granule The process of transfer , Yes, yes. default buffer pool Of resize operation :

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/133838.html Link to the original text :https://javaforall.cn

原网站

版权声明
本文为[Full stack programmer webmaster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261331050008.html