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記憶體
- 記憶體檢查指令碼記憶體指令碼
- Linux上執行記憶體中的指令碼和程式Linux記憶體指令碼
- Linux記憶體子系統——Locking Pages(記憶體鎖定)Linux記憶體
- 利用 Shell 指令碼來監控 Linux 系統的記憶體指令碼Linux記憶體
- Linux設定虛擬記憶體教學和實戰Linux記憶體
- 用 Bash 指令碼監控 Linux 上的記憶體使用情況指令碼Linux記憶體
- 如何用bash shell 指令碼監控 Linux記憶體、磁碟和 CPU?指令碼Linux記憶體
- eclipse中設定JVM記憶體EclipseJVM記憶體
- JVM 堆記憶體設定原理JVM記憶體
- eclipse設定JVM記憶體堆EclipseJVM記憶體
- 設定SQLserver執行記憶體SQLServer記憶體
- linux mysql定時備份指令碼記錄LinuxMySql指令碼
- jvm記憶體設定及記憶體溢位、解決方案JVM記憶體溢位
- Oracle:記憶體設定注意事項Oracle記憶體
- 怎麼設定虛擬記憶體win10 win10虛擬記憶體如何設定記憶體Win10
- win10虛擬記憶體怎麼設定 win10虛擬記憶體設定方法Win10記憶體
- linux啟定時指令碼Linux指令碼
- Linux開啟防火牆並設定策略指令碼Linux防火牆指令碼
- [Linux]共享記憶體Linux記憶體
- 關於虛擬機器記憶體和JVM記憶體設定的思考虛擬機記憶體JVM
- win10虛擬記憶體怎麼設定最好 win10虛擬記憶體設定多少好Win10記憶體
- 解決SqlServer執行指令碼,檔案過大,記憶體溢位問題SQLServer指令碼記憶體溢位
- linux記憶體管理(一)實體記憶體的組織和記憶體分配Linux記憶體
- 設定Linux伺服器IP地址的shell指令碼Linux伺服器指令碼
- win10虛擬記憶體設定多少合適_win10電腦虛擬記憶體如何設定Win10記憶體
- win10虛擬記憶體怎麼設定 win10虛擬記憶體設定步驟詳解Win10記憶體
- win10電腦虛擬記憶體怎麼設定 win10虛擬記憶體設定的方法Win10記憶體
- win10虛擬記憶體怎麼設定最好 win10虛擬記憶體設定多少合適?Win10記憶體
- 持久記憶體指令(PMDK)簡介記憶體
- Linux實體記憶體管理Linux記憶體
- Linux 程式設計1:深入淺出 Linux 共享記憶體Linux程式設計記憶體
- Docker之CPU和記憶體磁碟設定(八)Docker記憶體
- 【伺服器】Ubuntu虛擬記憶體設定伺服器Ubuntu記憶體
- Linux中顯示記憶體和CPU使用率最高的程式的SHELL指令碼例子Linux記憶體指令碼
- win10怎樣設定虛擬記憶體大小_win10設定虛擬記憶體圖文步驟Win10記憶體
- Linux共享記憶體(二)Linux記憶體
- Linux 虛擬記憶體Linux記憶體
- win10 虛擬記憶體怎麼設定好 win10 虛擬記憶體設定方法Win10記憶體