Step 3: 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, set the
initialization parameters MEMORY_TARGET and MEMORY_MAX_TARGET to 0
(zero). Please see Document 749851.1 for further information in case you encounter the error below:
$ ./hugepages_settings.sh
...
Recommended setting: vm.nr_hugepages = 1496
$
Note: You can also calculate a proper value for the parameter
yourself but that is not advised if you do not have extensive experience
with HugePages and concepts.
Step 5: Edit the file /etc/sysctl.conf and set the vm.nr_hugepages parameter there:
...
vm.nr_hugepages = 1496
...
This will make the parameter to be set properly with each reboot.
Step 6: Stop all the database instances and reboot the server
(Although
settings could have been done dynamically they would not be effective
to the extent we require before a reboot. The best practice is to do a
persistent system configuration and perform a reboot to complete the
configuration as presented through the steps above)
# grep HugePages /proc/meminfo
HugePages_Total: 1496
HugePages_Free: 485
HugePages_Rsvd: 446
HugePages_Surp: 0
The values in the output will vary. To make sure that the configuration is valid, the HugePages_Free value should be smaller than HugePages_Total and there should be some HugePages_Rsvd. HugePages_Rsvd counts free pages that are reserved for use (requested for an SGA, but not touched/mapped yet).
The sum of Hugepages_Free and HugePages_Rsvd may be smaller than your total combined SGA as instances allocate pages dynamically and proactively as needed.
四、计算大页Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration
1.[root@wang ~]# vi hugepages_settings.sh
--添加如下脚本