hugepages_setting(linux大記憶體設定指令碼)
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
#
# 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
#
# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support
() where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments. Before proceeding with the execution please make sure
that:
* Oracle Database instance(s) are up and running
* Oracle Database 11g 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}'`
# Initialize the counter
NUM_PG=0
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk '{print $5}' | 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 11g Automatic Memory Management (AMM) is not configured"
exit 1
fi
# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac
# End
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
#
# 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
#
# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support
() where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments. Before proceeding with the execution please make sure
that:
* Oracle Database instance(s) are up and running
* Oracle Database 11g 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}'`
# Initialize the counter
NUM_PG=0
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk '{print $5}' | 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 11g Automatic Memory Management (AMM) is not configured"
exit 1
fi
# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac
# End
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25462274/viewspace-2124958/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 記憶體檢查指令碼記憶體指令碼
- Linux檢視佔用記憶體的程式指令碼Linux記憶體指令碼
- ORACLE 記憶體規劃及LINUX核心設定Oracle記憶體Linux
- JVM堆記憶體設定JVM記憶體
- Tomcat記憶體設定Tomcat記憶體
- Linux 核心高-低端記憶體設定程式碼跟蹤(ARM構架)Linux記憶體
- Linux中設定hugepages 在記憶體中 lock SGALinux記憶體
- 記憶體_大頁記憶體記憶體
- 設定SQLserver執行記憶體SQLServer記憶體
- JVM 堆記憶體設定原理JVM記憶體
- 利用 Shell 指令碼來監控 Linux 系統的記憶體指令碼Linux記憶體
- nagios監控linux主機監控記憶體指令碼iOSLinux記憶體指令碼
- Linux記憶體子系統——Locking Pages(記憶體鎖定)Linux記憶體
- jvm記憶體設定及記憶體溢位、解決方案JVM記憶體溢位
- Linux設定虛擬記憶體教學和實戰Linux記憶體
- 用 Bash 指令碼監控 Linux 上的記憶體使用情況指令碼Linux記憶體
- 如何用bash shell 指令碼監控 Linux記憶體、磁碟和 CPU?指令碼Linux記憶體
- eclipse設定JVM記憶體堆EclipseJVM記憶體
- Oracle:記憶體設定注意事項Oracle記憶體
- eclipse中設定JVM記憶體EclipseJVM記憶體
- ActiveMQ記憶體設定和流控MQ記憶體
- eclipse.ini記憶體設定Eclipse記憶體
- 11g記憶體的設定記憶體
- Sql Server實體記憶體及虛擬記憶體設定的總結SQLServer記憶體
- C語言-記憶體管理之二[記憶體指令]C語言記憶體
- nagios-建立記憶體監控指令碼iOS記憶體指令碼
- win10虛擬記憶體怎麼設定 win10虛擬記憶體設定方法Win10記憶體
- 怎麼設定虛擬記憶體win10 win10虛擬記憶體如何設定記憶體Win10
- Win10設定虛擬記憶體方法 Win10怎麼設定虛擬記憶體Win10記憶體
- [整理] 32Bit Windows & SQL Server 大容量記憶體使用設定WindowsSQLServer記憶體
- ios10升級後記憶體變大怎麼設定 ios10釋放記憶體方法iOS記憶體
- linux大記憶體Hugepages最佳化Linux記憶體
- 2 Day DBA-管理Oracle例項-管理記憶體-修改記憶體設定-自動記憶體管理Oracle記憶體
- sqlserver執行時記憶體設定方法SQLServer記憶體
- linux mysql定時備份指令碼記錄LinuxMySql指令碼
- 關於虛擬機器記憶體和JVM記憶體設定的思考虛擬機記憶體JVM
- Linux 記憶體管理:記憶體對映Linux記憶體
- 簡單分配和釋放記憶體指令碼[更新]記憶體指令碼