如何将使用AMM(自动内存管理)数据库转换为已配置有大页Hugepages的数据库 (Doc ID 2128928.1)

How To Convert A Database Using AMM (Automatic Memory Management) To A Database That Has Been Configured With Hugepages (Doc ID 2128928.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.2 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Linux x86-64

GOAL

Here we are providing an overview of converting a Database using AMM (Automatic Memory Management) to a Database that has been configured with HugePages.  在这里,我们提供了将使用AMM(自动内存管理)的数据库转换为已使用HugePages配置的数据库的概述。

SOLUTION

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

步骤1:将AMM(自动内存管理)转换为ASMM(自动共享内存管理)

Here the first point is, the use of AMM (memory_target and memory_max_target) is absolutely incompatible with HugePages.这里的第一点是,AMM (memory_target and memory_max_target)的使用与HugePages绝对不兼容。
Only ASMM is supported with LINUX x86-64 Hugepages (you may need to refer Doc ID 1134002.1 for further details). LINUX x86-64 Hugepages仅支持ASMM(有关更多详细信息,您可能需要参考Doc ID 1134002.1)。

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.  现在,如果您的数据库配置AMM,则可能需要将AMM转换为ASMM。为此,您可能需要检查SGA和PGA的用法,然后相应地设置参数。您可以使用下面的SQL作为脚本来查找内存配置和使用情况。

This will generate two spool files (mem_config.log, mem_usage.log). 这将生成两个假脱机文件(mem_config.log, mem_usage.log)
Based on the report on these spool files, you can convert AMM to ASMM and configure appropriate values. 基于这些假脱机文件的报告,您可以将AMM转换为ASMM并配置适当的值。

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.  步骤:2一旦确定了内存使用情况(SGA, PGA),就需要在现有实例中配置/重新配置这些参数。
               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  步骤:3取消设置AMM内存参数

MEMORY_MAX_TARGET
MEMORY_TARGET

Once we complete this step, the conversion part is completed from AMM to ASMM.  一旦完成此步骤,就完成了从AMM到ASMM的转换部分。

Step: 4  Configuring HugePages  步骤:4配置HugePages

Now coming back to HugePages configuration part, here you may need to involve your Linux Admin and cross-check the environment.  现在回到HugePages配置部分,在这里您可能需要让Linux Admin参与并交叉检查环境。

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.  您需要检查系统上有多少可用RAM。HugePages在物理RAM中运行并固定在其中,因此您想知道有多少RAM可用以及可以为数据库使用多少。另外,您可能需要重新启动服务器,并且可能需要维护
窗口。

You can go through below documentation, metalink notes for further guidance on configuring HugePages.  您可以阅读以下文档,metalink notes以获取有关配置HugePage的进一步指导。

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.  vm.nr_hugepages定义hugepages的数量。并且 (vm.nr_hugepages * Hugeagesize) 决定了HugePage可用的内存量。
(you can check the Hugepagesize by using - grep -i "Hugepagesize" /proc/meminfo). (您可以使用-grep -i "Hugepagesize" /proc/meminfo检查Hugepagesize)

After this you should see output like example below that indicates HugePage has been configured:  之后,您应该看到类似以下示例的输出,指示已配置HugePage

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.  一旦在系统中配置了HugePage,数据库就会自动使用hugepages 进行SGA分配。

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. 确保系统中的(vm.nr_hugepages * Hugepagesize) ,即HugePage内存应大于所有SGA的总和,即sga_max_size(如果服务器中有多个数据库)

Step: 5  Monitoring and fine tuning HugePages  步骤:5监视和微调HugePages

In the alert log you can see the HugePage information during instance startup.  在警报日志中,您可以在实例启动期间看到HugePage信息。
Also from 11.2.0.2 onwards, there is a parameter called USE_LARGE_PAGES that provides very useful information in the alert log. 同样从11.2.0.2开始,还有一个名为USE_LARGE_PAGES的参数在警报日志中提供了非常有用的信息。

Once configured, you can fine tune the HugePage configuration by using script mentioned in below document: 配置完成后,您可以使用以下文档中提到的脚本来微调HugePage配置:

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.  HugePages的错误配置可能导致许多问题。其中一些包括-未使用大页面,数据库性能不佳,内存不足或交换过多,数据库实例未启动等。

Regarding Trouble shooting and Known issues, you can refer below metalink note-  关于故障排除和已知问题,您可以在下面参考metalink注意事项

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

REFERENCES

NOTE:361323.1 - HugePages on Linux: What It Is... and What It Is Not...
NOTE:361468.1 - HugePages on Oracle Linux 64-bit
NOTE:401749.1 - Oracle Linux: Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration
NOTE:1134002.1 - ASMM versus AMM and LINUX x86-64 Hugepages Support

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值