amm与hugepage是否能同时使用

news/2025/2/24 11:44:37

今天遇到个现象,在开启hugepage的前提下,设置数据库内存管理模式为amm,发现集群启动不了,无法申请相应内存

从MOS的官方解释,AMM与HUGEPAGE不兼容

Following are the limitations of using HugePages:

    • The Automatic Memory Management (AMM) and HugePages are not compatible. With AMM the entire SGA memory is allocated by creating files under /dev/shm. When Oracle Database allocates SGA that way HugePages are not reserved. You must disable AMM on Oracle Database 11g to use HugePages.

    • If you are using VLM in a 32-bit environment, then you cannot use HugePages for the Database Buffer cache. HugePages can be used for other parts of SGA like shared_pool, large_pool, and so on. Memory allocation for VLM (buffer cache) is done using shared memory file systems (ramfs/tmpfs/shmfs). HugePages does not get reserved or used by the memory file systems.

    • HugePages are not subject to allocation or release after system startup, unless a system administrator changes the HugePages configuration by modifying the number of pages available, or the pool size. If the space required is not reserved in memory during system startup, then HugePages allocation fails.

SOLUTION

Step 1:  Convert AMM (Automatic Memory Management) to ASMM (Automatic Shared Memory Management)

Here the first point is, the use of AMM (memory_target and memory_max_target) is absolutely incompatible with HugePages.
Only ASMM is supported with LINUX x86-64 Hugepages (you may need to refer Doc ID 1134002.1 for further details).

Now in case if your Database is configured in AMM, you may need to convert AMM to ASMM. For this you may need to check the usage of SGA and PGA and then
set the parameters accordingly. You can use below SQLs as a script to find out the memory configuration and usage.

This will generate two spool files (mem_config.log, mem_usage.log).
Based on the report on these spool files, you can convert AMM to ASMM and configure appropriate values.

set pagesize 1000 lines 1000 linesize 1000
spool mem_config.log
prompt memory configuration parameters:
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
break on dbname nodup
col dbname format a30
col name format a45
col value format a20
select sys_context ('USERENV', 'DB_NAME') dbname,
name,
value
from v$parameter
where ( name like '%memory%'
or name like '%sga%'
or name like '%pool%'
or name like '%cache%' )
and ( name like '%size%'
or name like '%target%' )
order by name;

prompt startup values:
prompt ~~~~~~~~~~~~~~~
col parm format a40
col sessval format a15
col instval format a15
select a.ksppinm parm,
b.ksppstvl sessval,
c.ksppstvl instval
from sys.x$ksppi a,
sys.x$ksppcv b,
sys.x$ksppsv c
where a.indx = b.indx
and a.indx = c.indx
and a.ksppinm in ( '__shared_pool_size', '__db_cache_size', '__large_pool_size', '__java_pool_size',
'__streams_pool_size', '__pga_aggregate_target', '__sga_target', '_kghdsidx_count',
'_ksmg_granule_size', '_memory_imm_mode_without_autosga' );

spool off
spool mem_usage.log
prompt memory advisories:
prompt ~~~~~~~~~~~~~~~~~~
-- memory target advisory
select *
from v$memory_target_advice;

-- sga target advisory
select *
from v$sga_target_advice;

prompt sgastat details:
prompt ~~~~~~~~~~~~~~~~
break on pool nodup
col bytes format 999, 999, 999, 999, 999, 999
select pool,
name,
bytes
from (select pool,
name,
bytes
from v$sgastat
where pool is null
order by bytes desc)
where rownum <= 5
union all
select pool,
name,
bytes
from (select pool,
name,
bytes
from v$sgastat
where pool = 'shared pool'
order by bytes desc)
where rownum <= 5
union all
select pool,
name,
bytes
from (select pool,
name,
bytes
from v$sgastat
where pool = 'large pool'
order by bytes desc)
where rownum <= 5
union all
select pool,
name,
bytes
from (select pool,
name,
bytes
from v$sgastat
where pool = 'java pool'
order by bytes desc)
where rownum <= 5;

-- relevant only if PX buffers are occupying more memory in shared pool
show parameter parallel_automatic_tuning
select a.ksppinm name,
b.ksppstvl value,
b.ksppstdf defalt,
decode (a.ksppity, 1, 'boolean',
2, 'string',
3, 'number',
4, 'file',
a.ksppity) type,
a.ksppdesc description
from sys.x$ksppi a,
sys.x$ksppcv b
where a.indx = b.indx
and a.ksppinm like '%use%large%pool%'
order by name;

prompt sga, pga usage:
prompt ~~~~~~~~~~~~~~~
select name,
bytes
from v$sgainfo;

select round(sum(bytes) / 1024 / 1024, 2) current_sga_size_mb
from v$sgastat;

select round(sum(bytes) / 1024 / 1024, 2) hist_sga_size_mb
from dba_hist_sgastat;

select round(sum(bytes) / 1024 / 1024, 2) max_sga_size_mb
from v$sgainfo
where name = 'Maximum SGA Size';

select round(( value ) / 1024 / 1024, 2) current_pga_in_use_mb
from v$pgastat
where name = 'total PGA inuse';

select round(( value / 1024 / 1024 ), 2) max_pga_allocated_mb
from v$pgastat
where name = 'maximum PGA allocated';

select round(max(value) / 1024 / 1024, 2) hist_max_pga_allocated_mb
from dba_hist_pgastat
where name = 'maximum PGA allocated';

select round(value / 1024 / 1024, 2) pga_target_mb
from v$pgastat
where name = 'aggregate PGA target parameter';

select component,
current_size
from v$sga_dynamic_components;

col component for a25
select component,
round(( min(final_size / 1024 / 1024) ), 2) low_mb,
round(( max(final_size / 1024 / 1024) ), 2) high_mb
from v$sga_resize_ops
group by component
order by component;

spool off

Step: 2  Once we identify the memory usage (SGA, PGA), then we need to configure/ re-configure those parameters in existing instance. 
               This will ensure lower limit for SGA, PGA and Dynamic memory components.

SGA_TARGET
SGA_MAX_TARGET
PGA_AGGREGATE_TARGET

SHARED_POOL_SIZE
DB_CACHE_SIZE
LARGE_POOL_SIZE
JAVA_POOL_SIZE
STREAMS_POOL_SIZE

Step: 3  Unset the AMM memory parameters

MEMORY_MAX_TARGET
MEMORY_TARGET

Once we complete this step, the conversion part is completed from AMM to ASMM.

Step: 4  Configuring HugePages

Now coming back to HugePages configuration part, here you may need to involve your Linux Admin and cross-check the environment.

You need to check how much RAM you have available on the system. HugePages run in physical RAM and are pinned in it, so you want to know
how much RAM is available and how much you can use for databases. Also you may need to reboot your server, and may need a maintenance
window for this.

You can go through below documentation, metalink notes for further guidance on configuring HugePages.

HugePages on Oracle Linux 64-bit (Doc ID 361468.1)
https://docs.oracle.com/cd/E37670_01/E37355/html/ol_config_hugepages.html
HugePages on Linux: What It Is... and What It Is Not... (Doc ID 361323.1)

The vm.nr_hugepages defines the number of hugepages. And (vm.nr_hugepages * Hugeagesize) decided the amount of memory available for HugePage.
(you can check the Hugepagesize by using - grep -i "Hugepagesize" /proc/meminfo).

After this you should see output like example below that indicates HugePage has been configured:

Example:

# grep HugePages /proc/meminfo
HugePages_Total: 1496
HugePages_Free: 485
HugePages_Rsvd: 446
HugePages_Surp: 0

Once HugePage is configured in the system the database automatically uses hugepages for SGA allocation.

Ensure the(vm.nr_hugepages * Hugepagesize) i.e. the HugePage memory should be greater that than sum of all SGAs i.e sga_max_size
(if more than one database in the server) in the system.

Step: 5  Monitoring and fine tuning HugePages

In the alert log you can see the HugePage information during instance startup.
Also from 11.2.0.2 onwards, there is a parameter called USE_LARGE_PAGES that provides very useful information in the alert log.

Once configured, you can fine tune the HugePage configuration by using script mentioned in below document:

Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration (Doc ID 401749.1)

Incorrect configuration of HugePages can lead to many problems. Some of them includes - hugepages not used, poor db performance, running out of
memory or excessive swapping, db instance not start etc.

Regarding Trouble shooting and Known issues, you can refer below metalink note-

HugePages on Oracle Linux 64-bit (Doc ID 361468.1)

转载于:https://www.cnblogs.com/tonnytangy/p/8578519.html


http://www.niftyadmin.cn/n/709648.html

相关文章

如何创建mysql

今天学习数据库的一点皮毛知识&#xff0c;首先就是学会如何创建mysql,如果是在本机上登录&#xff0c;只需要在连接之后&#xff0c;输入命令行&#xff1a;mysql -uroot -p123123,这个命令行表示创建了一个数据库名为root,密码为123123&#xff0c;如果是在其它的平台上登录的…

*寒假水36——悼念512汶川大地震遇难同胞——重建希望小学(斐波那契数列)

这不&#xff0c;一所由社会各界捐款修建的希望小学马上就要竣工了&#xff01;学校教室的长度为n米&#xff0c;宽度为3米&#xff0c;现在我们有2种地砖&#xff0c;规格分别是1米1米&#xff0c;2米2米&#xff0c;如果要为该教室铺设地砖&#xff0c;请问有几种铺设方式呢&…

Ibatis.Net 入门学习(一)

由于工作需要&#xff0c;项目里用的是Ibatis.Net。所以就花时间学习学习&#xff0c;做做笔记吧。 1、打开SQLServer 2008&#xff0c;建一个数据库Test&#xff0c;一张表Person&#xff0c;添加入数据如下&#xff1a; 2、打开Vs2015&#xff0c; 新建一个控制台应用程序和两…

java里int和Integer什么区别

2019独角兽企业重金招聘Python工程师标准>>> 定义一个int变量&#xff0c;和Integer变量 int i; Integer j; 使用时有什么不同&#xff0c;什么情况下使用Integer型变量 Integer i0; i是一个对象 int i3; i是一个基础变量 Integer i0; 这种写法如果没记错&#x…

*寒假水37——母猪的故事(斐波那契数列)

话说现在猪肉价格这么贵&#xff0c;著名的ACBoy 0068 也开始了养猪生活。说来也奇怪&#xff0c;他养的猪一出生第二天开始就能每天中午生一只小猪&#xff0c;而且生下来的竟然都是母猪。 不过光生小猪也不行&#xff0c;0068采用了一个很奇特的办法来管理他的养猪场&#x…

用C#发邮件

以下有2种方法&#xff1a; 第一种: using System; using System.Net.Mail;//当时测试的是QQ邮箱 class TestMail {static void Main(string[] args){string mailContent "邮件内容";MailMessage msg new System.Net.Mail.MailMessage();msg.To.Add("41679523…

获取当前请求的URL的地址、参数、参数值、各种属性

1 //URL: http://localhost:1897/User/Press/UserContent.aspx/9878?id1#toc2 Request.ApplicationPath; //结果&#xff1a; /3 Request.PhysicalPath; //结果&#xff1a; D:\Projects\Solution\web\User\Press\UserContent.aspx4 …

*寒假水38——水仙花数

水仙花数是指一个 n 位数 ( n > 3 )&#xff0c;它的每个位上的数字的 n 次幂之和等于它本身。&#xff08;例如&#xff1a;1^3 5^3 3^3 153&#xff09; 给出一个整数M&#xff0c;求 > M的最小的水仙花数。 Input一个整数M&#xff08;10 < M < 1000&#…