1: Verify HugePages is not used yet

grep Huge /proc/meminfo
AnonHugePages:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

grep PageTables /proc/meminfo
PageTables:        20576 kB     # this can be very large for busy system

2: Set the memlock user limit

Have the memlock user limit set in the /etc/security/limits.conf file. Set the value (in KB) slightly smaller than installed RAM. If you have 10-GB RAM installed, set:

vi /etc/security/limits.conf
*   soft   memlock   9437184    # 10G * 1024 * 1024 * 0.9, in KB
*   hard   memlock   9437184

There is no harm in setting this value larger than your SGA requirements.

Log on again to the Oracle product owner account (for example, oracle ) and check
the memlock limit:

$ ulimit -l
9437184

3: Setup Oracle memory params properly

If you have Oracle Database 11g or later, the default database created uses the Automatic Memory Management (AMM) feature, which is incompatible with HugePages. Disable AMM before proceeding. To disable AMM, set the initialization parameters MEMORY_TARGET and MEMORY_MAX_TARGET to 0 (zero).

SQL> alter system set memory_max_target=0 scope=spfile;  --disable AMM
SQL> alter system set memory_target=0 scope=spfile;      --disable AMM
SQL> alter system set sga_max_size=6G scope=spfile;
SQL> alter system set sga_target=6G scope=spfile;

4: Calculate recommended HugePage number

Make sure that all your database instances are up (including ASM instances) as they would run on production. Use the hugepages_settings.sh script in Document 401749.1 to calculate the recommended value for the vm.nr_hugepages kernel parameter:

$ ./hugepages_settings.sh
...
Recommended setting: vm.nr_hugepages = 3079     # a little bit larger than SGA (6G = 3072 x 2M )

5: Config recommended HugePage number

Edit the /etc/sysctl.conf file and set the vm.nr_hugepages parameter:

vi /etc/sysctl.conf

vm.nr_hugepages = 3079

This causes the parameter to be set properly with each reboot.

6: Reboot your system to take effect

Stop all the database instances and reboot the server. The performed configuration is based on the RAM installed and combined size of SGA of database instances that you are running. If any of the following changes occur, revise your HugePages configuration to make it suitable to the new memory framework:
• Changes to the amount of RAM installed for the Linux OS
• New database instance(s) introduced
• Changes to SGA size or configuration for one or more database instances

7: Validate HugePages is in use

After the system is rebooted, make sure that your database instances (including the ASM instances) are started. Automatic startup via OS configuration or CRS, or manual startup (whichever method you use) has been performed. Check the HugePages state from /proc/meminfo :

# check huge pages usage
grep Huge /proc/meminfo
AnonHugePages:         0 kB
HugePages_Total:    3079
HugePages_Free:     2475        # means used (3079 - 2475)*2 = 1208M, as time going on, used will be more, Free will be less
HugePages_Rsvd:     2469
HugePages_Surp:        0
Hugepagesize:       2048 kB

# check page table size
grep PageTables /proc/meminfo
PageTables:        16528 kB     # this should be much smaller than that without huge pages used.

# alert.log
Starting ORACLE instance (normal)
****************** Large Pages Information *****************

Total Shared Global Region in Large Pages = 6146 MB (100%)

Large Pages used by this instance: 3073 (6146 MB)
Large Pages unused system wide = 6 (12 MB) (alloc incr 16 MB)
Large Pages configured system wide = 3079 (6158 MB)
Large Page size = 2048 KB
***********************************************************

ps: hugepages_settings.sh

#!/bin/bash

# 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

# 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" ;;
    '3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '3.10') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '4.1') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '4.14') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    *) echo "Kernel version $KERN is not supported by this script (yet). Exiting." ;;
esac

# End