orcl2.memory_target=11114905600
*.memory_target=0
修改后保存文件。
?
执行以下命令创建spfile:
oracle@node74:~> sqlplus / as sysdba
SQL> create spfile='+DG_ORA/orcl/spfileorcl.ora'from pfile='/home/oracle/pfile.ora';
?
Kernel.shmall是系统一次可以使用的最大共享内存大小。单位是page(4KB)。禁用AMM后,需要修改系统参数kernel.shmall,该参数设置过小的话,可能会导致数据库启动失败ORA-27102(详见附录4.2)。
ORACLE建议将其设置为系统中所有数据库实例的SGA总和。例如SGA总和为9GB,则需要设置kernel.shmall=9*1024*1024/4=2359296。?
以root用户登录两台数据库服务器,编辑sysctl.conf文件。
node74:~ # vi /etc/sysctl.conf
修改kernel.shmall参数:
kernel.shmall = 2359296
执行sysctl –p使配置生效:
node74:~ # sysctl -p
?
以oracle用户登录两台数据库服务器,通过sqlplus启动2个数据库实例。
oracle@node74:~> sqlplus / as sysdba
SQL> startup
?
确保全部实例都已经启动(包括ASM) ,然后以root用户运行hugepages_settings.sh(脚本内容见附录4.1)去评估需要设置的Hugepages的大小。
node74:/home/oracle # ./hugepages_settings.sh
This script is provided by Doc ID 401749.1 from MyOracle Support
(http://support.oracle.com) where it is intended tocompute values for
the recommended HugePages/HugeTLB configuration forthe current shared
memory segments. Before proceeding with the executionplease make sure
that:
?* OracleDatabase instance(s) are up and running
?* OracleDatabase 11g Automatic Memory Management (AMM) is not setup
? (See Doc ID749851.1)
?* The sharedmemory segments can be listed by command:
? ? # ipcs -m
?Press Enter toproceed...
----直接按Enter键
Recommended setting: vm.nr_hugepages = 4611
?
也可以手工计算:
nr_hugepages>=SGA_Target/Hugepagesize
=9G*1024M/2M
=4608
取一个比4608稍大的值即可。
?
以root用户登录两台数据库服务器,编辑/etc/sysctl.conf:
node74:~ # vi /etc/sysctl.conf
修改vm.nr_hugepages参数为上一步中计算出来的值:
vm.nr_hugepages = 4611
执行sysctl –p使配置生效:
node74:~ # sysctl -p
?
停止所有数据库实例,重启操作系统。(理论上不需要重启操作系统,建议重启)
?
系统重启后,启动全部的数据库,通过以下命令检查配置是否生效:
node74:~ # grep HugePages /proc/meminfo
HugePages_Total:? ?4611
HugePages_Free:? ? 2394
HugePages_Rsvd:? ? 2387
HugePages_Surp:? ? ? ?0
?
HugePages_Free< HugePages_Total则说明Hugepages已经生效,同时HugePages_Rsvd不为0。?
#!/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
# 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. 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
e