A while ago, I wrote an article on huge page configuration, which you can find at the following link:
https://vahiddb.com/en/oracle/database-performance/hugepage-setting-en
Now, I’d like to write about some potential issues that can arise, which I have personally encountered. The error you might face is:
ORA-27137: unable to allocate large pages to create a shared memory segment
Linux-x86_64 Error: 12: Cannot allocate memory
This error, which is detailed in the alert log, indicates the number of pages required and the number actually allocated.
This error shows that Oracle is attempting to use Huge Pages but is unable to allocate the required memory to create a shared memory segment due to insufficient memory or inadequate settings. Below, I’ll go over a few steps to resolve this error.
Before we start, please remember: if you've made any changes to parameters requiring a database restart, be sure to create a pfile
beforehand.
Steps to Resolve ORA-27137 Error
1. Check and Increase the Number of Huge Pages
One of the first steps is to increase the number of huge pages in sysctl.conf
. Based on your SGA requirements, adjust vm.nr_hugepages
as needed. For example:
vm.nr_hugepages=4096 # Increase the number of huge pages as required
Then, apply the new settings with the following command:
sysctl -p
2. Ensure Sufficient Memory Allocation to the Oracle User Group
Sometimes, the Oracle user group ID may not be configured correctly to access Huge Pages. This value should be set in sysctl.conf
as follows:
vm.hugetlb_shm_group=<oracle_user_group_id>
You can find the <oracle_user_group_id>
by running id -g oracle
to obtain the Oracle user group ID.
3. Free Up Memory and Cache for Allocation
If you have configured enough huge pages but still encounter an error, there may not be enough free memory available. In this case, you can free up system memory and cache with the following command:
sync; echo 3 > /proc/sys/vm/drop_caches
4. Verify Huge Page Allocation After Database Start-Up
To ensure proper allocation, check the Huge Page status after restarting the database:
grep HugePages /proc/meminfo
This command will display the status of huge pages and let you verify that they have been allocated correctly.
Conclusion
These steps can help resolve the ORA-27137 error and ensure that the database properly utilizes Huge Pages. Reviewing the alert log and addressing errors related to insufficient huge pages can contribute to optimizing system memory and enhancing Oracle database performance.