#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
# on Oracle Linux
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.
#
# This script is provided by Doc ID 401749.1 from My Oracle Support
# http://support.oracle.com
# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com) where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments on Oracle Linux. Before proceeding with the execution please note following:
* For ASM instance, it needs to configure ASMM instead of AMM.
* The 'pga_aggregate_target' is outside the SGA and
you should accommodate this while calculating the overall size.
* In case you changes the DB SGA size,
as the new SGA will not fit in the previous HugePages configuration,
it had better disable the whole HugePages,
start the DB with new SGA size and run the script again.
And make sure that:
* Oracle Database instance(s) are up and running
* Oracle Database Automatic Memory Management (AMM) is not setup
(See Doc ID 749851.1)
* The shared memory segments can be listed by command:
# ipcs -m
Press Enter to proceed..."
read
# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
if [ -z "$HPG_SZ" ];then
echo "The hugepages may not be supported in the system where the script is being executed."
exit 1
fi
# Initialize the counter
NUM_PG=0
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | cut -c44-300 | awk '{print $1}' | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`
# An SGA less than 100MB does not make sense
# Bail out if that is the case
if [ $RES_BYTES -lt 100000000 ]; then
echo "***********"
echo "** ERROR **"
echo "***********"
echo "Sorry! There are not enough total of shared memory segments allocated for
HugePages configuration. HugePages can only be used for shared memory segments
that you can list by command:
# ipcs -m
of a size that can match an Oracle Database SGA. Please make sure that:
* Oracle Database instance is up and running
* Oracle Database Automatic Memory Management (AMM) is not configured"
exit 1
fi
# Finish with results
echo "Recommended setting: vm.nr_hugepages = $NUM_PG";
# End
复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
Oracle数据库调整内存应该注意的几个问题
听见风的声音
296次阅读
2025-03-18 09:43:11
记一次ORA600内部错误故障分析与修复实录
Digital Observer
278次阅读
2025-03-05 09:33:15
数据库的易用性是多维度的
白鳝的洞穴
115次阅读
2025-03-06 09:26:58
Oracle 物理 DataGuard 机制全面解析(最佳参考)
Albert Tan DBA 之路
89次阅读
2025-03-10 17:28:06
rac开启系统防火墙导致其中一个节点无法启动
dm5250
49次阅读
2025-03-03 18:19:15
Oracle 10.2.0.5 DataGuard主从搭建-呆瓜式
Albert Tan DBA 之路
48次阅读
2025-03-12 10:05:53
Oracle故障处理秘籍(二)
呆呆的私房菜
47次阅读
2025-02-27 09:57:42
Oracle故障处理秘籍(三)
呆呆的私房菜
46次阅读
2025-02-28 15:08:18
Oracle大表数据导出指南
yuki
38次阅读
2025-03-20 16:27:24
紧急救援!SCN调整秘籍(二)
呆呆的私房菜
36次阅读
2025-03-25 10:37:52
热门文章
MySQL Shell介绍
2024-12-26 86浏览
Oracle Demantra Implementing Partitions for Performance (Doc ID 1227173.1)
2025-01-02 82浏览
Traces Generated With The Message 'Dumping Sorted Master Trigger List' (文档 ID 1098363.1)
2025-01-05 66浏览
dbstart generates "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener" error (Doc ID 336299.1)
2025-01-04 65浏览
ASM on Non-First Node (Second or Others) Fails to Start: PMON terminating the instance due to error 481 (文档 ID 1383737.1)
2025-01-12 60浏览
最新文章
Oracle切换undo表空间操作步骤
2025-02-27 24浏览
rman恢复数据库归档日志
2025-02-26 32浏览
Usage, Benefits and Limitations of Standby Redo Logs (SRL) (Doc ID 219344.1)
2025-01-18 49浏览
How to Unplug and Plugin PDB (文档 ID 2728046.1)
2025-01-14 27浏览
ASM on Non-First Node (Second or Others) Fails to Start: PMON terminating the instance due to error 481 (文档 ID 1383737.1)
2025-01-12 60浏览