2 Calculate the number of required hugepages
3 Update /etc/sysctl.conf
4 Update the limits configuration file
5 Check/change the parameter to force the instance to use large pages
6 Set the SGA parameters
7 Restart the database in open mode
8 Check available hugepages
9 Check the Oracle database alert log
10 Check the memory usage
Hugepages is a Linux memory management feature that allows the operating system to use larger memory pages (2 MB by default) instead of the standard 4 KB pages. Configuring hugepages for Oracle databases significantly improves performance by reducing the overhead of memory management and TLB (Translation Lookaside Buffer) misses. Many customers are missing this critical configuration, which can lead to suboptimal database performance.
This guide walks through the complete steps to configure hugepages on a Red Hat-based Linux system for Oracle EBS.
1 Stop EBS applications
Before making any changes, stop all running EBS applications to free up memory resources.
2 Calculate the number of required hugepages
Divide the SGA size in bytes by 2048*1024 (2048 kB is the default hugepage size).
Example for an 80 GB (81920 MB) SGA:
80*1024*1024*1024/(2048*1024) = 80 * 512 + 5 = 40965 hugepagesAs a quick rule of thumb: multiply the number of Gigabytes by 512, then add 5 extra hugepages as a buffer.
3 Update /etc/sysctl.conf
Update /etc/sysctl.conf with the recommended setting. Open the file with vi and set the number of hugepages:
vi /etc/sysctl.conf
vm.nr_hugepages=40965Then take the parameters into effect by running:
sysctl -p4 Update the limits configuration file
Add the following entries into a config file under /etc/security/limits.d/. This is usually a config file created by the oracle preinstall RPM and looks similar to: oracle-database-preinstall-19c.conf
If there is no such file, update the default Linux file /etc/security/limits.conf:
oracle hard memlock unlimited
oracle soft memlock unlimitedThe server does not need to be restarted after applying these changes, but Linux users need to re-login to see the difference. You may use the following command to check the current memlock limit for the current session:
ulimit -l5 Check/change the parameter to force the instance to use large pages
Connect to the database as sysdba and verify/set the use_large_pages parameter:
sqlplus '/as sysdba'
show parameter use_large_pages
alter system set use_large_pages=ONLY scope=spfile;6 Set the SGA parameters
Change sga_target and sga_max_size to the required values. Note that sga_max_size should be set only on the CDB level, while sga_target should be set to the same value on both the CDB and PDB levels.
sqlplus '/as sysdba'
alter system set sga_max_size=10G scope=spfile;
alter system set sga_target=10G scope=spfile;
alter system set sga_target=10G container=all scope=spfile;Result cache should be modified only on the PDB level:
sqlplus '/as sysdba'
alter session set container=XXXX;
alter system set RESULT_CACHE_MAX_SIZE=600M;7 Restart the database in open mode
shu immediate
startup8 Check available hugepages
After the database has started, verify that hugepages are being used:
[oracle@apps ~]$ grep Huge /proc/meminfo
HugePages_Total: 6150
HugePages_Free: 13
HugePages_Rsvd: 9
HugePages_Surp: 0
Hugepagesize: 2048 kB9 Check the Oracle database alert log
Check the Oracle database alert log for confirmation that hugepages are configured. You should see output similar to the following:
2018-07-19 06:52:34.199000 +02:00
Starting ORACLE instance (normal) (OS id: 26730)
Dump of system resources acquired for SHARED GLOBAL AREA (SGA):
Per process system memlock (soft) limit = 14G
Expected per process system memlock (soft) limit to lock
SHARED GLOBAL AREA (SGA) into memory: 12G
Available system pagesizes:
4K, 2048K
Supported system pagesize(s):
PAGESIZE AVAILABLE_PAGES EXPECTED_PAGES ALLOCATED_PAGES ERROR(s)
2048K 6150 6146 6146 NONE10 Check the memory usage
Verify the memory state after database startup with hugepages configured. Hugepages are reported in the used section as they are allocated at system startup:
[root@r12_local ~]# free -mh
total used free shared buffers cached
Mem: 5.8G 3.1G 2.8G 340K 25M 935M
-/+ buffers/cache: 2.1G 3.7G
Swap: 1.7G 0B 1.7G