oracle orion hugepages_settings.sh(支持OEL 7,4.1内核)

orion需要首先配置hugepage,否则会出现下列错误。
[root@yyxxdb01 ~]# /opt/app/11.2.0/grid_home/bin/orion -run oltp -testname mytest
ORION: ORacle IO Numbers -- Version 11.2.0.4.0
************************ Large Pages Information *******************
Parameter use_large_pages = onlyPer process system memlock (soft) limit = 64 KB
 
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 0 (0 KB)
Large Page size = 2048 KB 
ERROR:
  Failed to allocate shared global region with large pages, unix errno = 12.
  Aborting the run of Orion.  ORA-27137: unable to allocate Large Pages to create a shared memory segment
ACTION:
  Total Orion I/O Buf Area size is 6144 KB. Prior to next instance restart:
 
 1. Increase the number of unused large pages (page size 2048 KB)
 to at least 3 (6144 KB) to allocate 100% Orion I/O Buf Area
 with large pages.
 
 2. Large pages are automatically locked into physical memory.
 Increase the per process memlock (soft) limit to at least 8192 KB to lock
 100% Orion I/O Buf Area's large pages into physical memory
*******************************************************************
Increase huge pages as suggested or set  -hugenotneeded flag on command line
Failed to create shared memory of size 1051296 (orion_setup_shmem:skgmcreate)
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 2097152
orion_parse_args: orion_setup_shmem failed
#!/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.

# Check for the kernel version

KERN=`uname -r | awk -F. '{ printf("%d.%d
",$1,$2); }'`

# Find out the HugePage size

HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`

# Start from 1 pages to be on the safe side and guarantee 1 free HugePage

NUM_PG=1

# Cumulative number of pages required to handle the running shared memorysegments

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

# 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' | '3.8' | '4.1') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;

    *) echo "Unrecognizedkernel version $KERN. Exiting." ;;

esac

# End

$ chmod u+x hugepages_setting.sh

$ ./hugepages_setting.sh

在"/etc/sysctl.conf"文件里配置huagepages:

vm.nr_hugepages=306

Run the following command as the"root" user.

说明hugepages的配置可以用sysctl –p进行实时生效

# sysctl -p

原文地址:https://www.cnblogs.com/zhjh256/p/9874743.html