Linux安装Oracle数据库配置大页内存

Linux安装Oracle数据库配置大页内存

 参考文档

HugePages on Oracle Linux 64-bit (文档 ID 361468.1)

Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration (文档 ID 401749.1)

 

如果装完linux 内存超过64G的话  尽量把大页内存打开

1、修改/etc/security/limits.conf

*   soft   memlock    60397977
*   hard   memlock    60397977

单位是KB 数值比内存大小要小

2、使用ulimit-l命令检查memlock数值

$ ulimit -l
60397977

3、如果数据库版本是11g以后的版本,使用了HUGEPAGE之后 不能使用AMM特性(Automatic Memory Management)否则会提示如下错误

ORA-00845: MEMORY_TARGET not supported on this system

4、使用文档 ID 401749.1的脚本生成如下结果

$ ./hugepages_settings.sh
...
Recommended setting: vm.nr_hugepages = 1496
$

5、在/etc/sysctl.conf文件中添加内容

vm.nr_hugepages = 1496

6、停掉所有数据库实例,重启服务器生效

7、使用如下命令检查是否生效

# grep HugePages /proc/meminfo

HugePages_Total:    1496
HugePages_Free:      485
HugePages_Rsvd:      446
HugePages_Surp:        0

 

如果HugePages_Total= HugePages_Free 说明大页配置没有生效

  

**********************401749.1脚本内容如下*********************************************

  

  
  
  1. #!/bin/bash
  2. #
  3. # hugepages_settings.sh
  4. #
  5. # Linux bash script to compute values for the
  6. # recommended HugePages/HugeTLB configuration
  7. #
  8. # Note: This script does calculation for all shared memory
  9. # segments available when the script is run, no matter it
  10. # is an Oracle RDBMS shared memory segment or not.
  11. #
  12. # This script is provided by Doc ID 401749.1 from My Oracle Support 
  13. # http://support.oracle.com
  14. # Welcome text
  15. echo "
  16. This script is provided by Doc ID 401749.1 from My Oracle Support 
  17. (http://support.oracle.com) where it is intended to compute values for 
  18. the recommended HugePages/HugeTLB configuration for the current shared 
  19. memory segments. Before proceeding with the execution please note following:
  20.  * For ASM instance, it needs to configure ASMM instead of AMM.
  21.  * The 'pga_aggregate_target' is outside the SGA and 
  22.    you should accommodate this while calculating SGA size.
  23.  * In case you changes the DB SGA size, 
  24.    as the new SGA will not fit in the previous HugePages configuration, 
  25.    it had better disable the whole HugePages, 
  26.    start the DB with new SGA size and run the script again.
  27. And make sure that:
  28.  * Oracle Database instance(s) are up and running
  29.  * Oracle Database 11g Automatic Memory Management (AMM) is not setup 
  30.    (See Doc ID 749851.1)
  31.  * The shared memory segments can be listed by command:
  32.      # ipcs -m
  33. Press Enter to proceed..."
  34. read
  35. # Check for the kernel version
  36. KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
  37. # Find out the HugePage size
  38. HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
  39. if[-z "$HPG_SZ"];then
  40.     echo "The hugepages may not be supported in the system where the script is being executed."
  41.     exit 1
  42. fi
  43. # Initialize the counter
  44. NUM_PG=0
  45. # Cumulative number of pages required to handle the running shared memory segments
  46. for SEG_BYTES in`ipcs -m | cut -c44-300 | awk '{print $1}' | grep "[0-9][0-9]*"`
  47. do
  48.     MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
  49.     if[ $MIN_PG -gt 0];then
  50.         NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
  51.     fi
  52. done
  53. RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`
  54. # An SGA less than 100MB does not make sense
  55. # Bail out if that is the case
  56. if[ $RES_BYTES -lt 100000000];then
  57.     echo "***********"
  58.     echo "** ERROR **"
  59.     echo "***********"
  60.     echo "Sorry! There are not enough total of shared memory segments allocated for 
  61. HugePages configuration. HugePages can only be used for shared memory segments 
  62. that you can list by command:
  63.     # ipcs -m
  64. of a size that can match an Oracle Database SGA. Please make sure that:
  65.  * Oracle Database instance is up and running 
  66.  * Oracle Database 11g Automatic Memory Management (AMM) is not configured"
  67.     exit 1
  68. fi
  69. # Finish with results
  70. case $KERN in
  71.     '2.2') echo "Kernel version $KERN is not supported. Exiting.";;
  72.     '2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
  73.            echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL";;
  74.     '2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG";;
  75.     '3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG";;
  76. esac
  77. # End
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值