ITPUX技术网

交流 . 资讯 . 分享
Make progress together!
Linux操作系统下Oracle11g R2 RAC 安装配置教程
Oracle数据库培训-备份恢复-性能优化-集群容灾
Oracle数据库DBA高级工程师培训视频

配置Linux服务器 hugepages

内容发布:laojiansg151| 发布时间:2017-6-15 20:56:50
1 配置limits.conf


[oracle@xkan ~]$ free -m             total       used       free     shared    buffers     cachedMem:          5709       2386       3322          1         25        366-/+ buffers/cache:       1994       3715Swap:         5999          0       5999
  根据内存大小,我们配置5G到memlock

[root@xkan ~]# grep memlock /etc/security/limits.conf #        - memlock - max locked-in-memory address space (KB)*                   soft    memlock 5242880*                   hard    memlock 5242880
  参数生效需要重启


[root@xkan ~]# ulimit -l5242880
  2 查看AMM是否关闭


[oracle@xkan ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 14 19:47:34 2017Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> show parameter sgaNAME                                     TYPE         VALUE------------------------------------ ----------- ------------------------------lock_sga                             boolean         FALSEpre_page_sga                             boolean         FALSEsga_max_size                             big integer 1728Msga_target                             big integer 1728MSQL> show parameter pgaNAME                                     TYPE         VALUE------------------------------------ ----------- ------------------------------pga_aggregate_target                     big integer 571MSQL> show parameter memoryNAME                                     TYPE         VALUE------------------------------------ ----------- ------------------------------hi_shared_memory_address             integer         0memory_max_target big integer 0memory_target big integer 0shared_memory_address                     integer         0


  3 使用 hugepages_settings.sh 计算 vm.nr_hugepages
  需要在所有oracle实例包括ASM实例都启动的情况下进行


[oracle@xkan ~]$ vim hugepages_settings.sh[oracle@xkan ~]$ ./hugepages_settings.sh-bash: ./hugepages_settings.sh: Permission denied[oracle@xkan ~]$ chmod 755 hugepages_settings.sh[oracle@xkan ~]$ ./hugepages_settings.shThis script is provided by Doc ID 401749.1 from My Oracle Support(http://support.oracle.com) where it is intended to compute values forthe recommended HugePages/HugeTLB configuration for the current sharedmemory segments on Oracle Linux. Before proceeding with the execution please note following: * For ASM instance, it needs to configure ASMM instead of AMM. * The 'pga_aggregate_target' is outside the SGA and   you should accommodate this while calculating SGA size. * In case you changes the DB SGA size,   as the new SGA will not fit in the previous HugePages configuration,   it had better disable the whole HugePages,   start the DB with new SGA size and run the script again.And make sure that: * Oracle Database instance(s) are up and running * Oracle Database 11g Automatic Memory Management (AMM) is not setup   (See Doc ID 749851.1) * The shared memory segments can be listed by command:     # ipcs -mPress Enter to proceed...Recommended setting: vm.nr_hugepages = 868
  
hugapages_settings.sh  
  [oracle@xkan ~]$ cat hugepages_settings.sh#!/bin/bash## hugepages_settings.sh## Linux bash script to compute values for the# recommended HugePages/HugeTLB configuration# on Oracle Linux## 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.## This script is provided by Doc ID 401749.1 from My Oracle Support# http://support.oracle.com# Welcome textecho "This script is provided by Doc ID 401749.1 from My Oracle Support(http://support.oracle.com) where it is intended to compute values forthe recommended HugePages/HugeTLB configuration for the current sharedmemory segments on Oracle Linux. Before proceeding with the execution please note following: * For ASM instance, it needs to configure ASMM instead of AMM. * The 'pga_aggregate_target' is outside the SGA and   you should accommodate this while calculating SGA size. * In case you changes the DB SGA size,   as the new SGA will not fit in the previous HugePages configuration,   it had better disable the whole HugePages,   start the DB with new SGA size and run the script again.And make sure that: * Oracle Database instance(s) are up and running * Oracle Database 11g Automatic Memory Management (AMM) is not setup   (See Doc ID 749851.1) * The shared memory segments can be listed by command:     # ipcs -mPress Enter to proceed..."read# Check for the kernel versionKERN=`uname -r | awk -F. '{ printf("%d.%d/n",$1,$2); }'`# Find out the HugePage sizeHPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`if [ -z "$HPG_SZ" ];then    echo "The hugepages may not be supported in the system where the script is being executed."    exit 1fi# Initialize the counterNUM_PG=0# Cumulative number of pages required to handle the running shared memory segmentsfor SEG_BYTES in `ipcs -m | cut -c44-300 | awk '{print $1}' | 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`    fidoneRES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`# An SGA less than 100MB does not make sense# Bail out if that is the caseif [ $RES_BYTES -lt 100000000 ]; then    echo "***********"    echo "** ERROR **"    echo "***********"    echo "Sorry! There are not enough total of shared memory segments allocated forHugePages configuration. HugePages can only be used for shared memory segmentsthat you can list by command:    # ipcs -mof a size that can match an Oracle Database SGA. Please make sure that: * Oracle Database instance is up and running * Oracle Database 11g Automatic Memory Management (AMM) is not configured"    exit 1fi# Finish with resultscase $KERN in    '2.2') echo "Kernel version $KERN is not supported. Exiting." ;;    '2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;           echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;    '2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;    '3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;    '3.10') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;    '4.1') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;esac# End  

  4 配置 /etc/sysctl.conf 文件


[root@xkan ~]# vim /etc/sysctl.conf[root@xkan ~]# grep vm.nr_hugepages /etc/sysctl.confvm.nr_hugepages=868
  5 重启实例和服务器,检查 hugepage 配置情况


[root@xkan ~]# su - oracle[oracle@xkan ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 14 20:12:59 2017Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options[oracle@xkan ~]$ lsnrctl stopLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-JUN-2017 20:13:24Copyright (c) 1991, 2013, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))The command completed successfully[oracle@xkan ~]$ exitlogout[root@xkan ~]# reboot[root@xkan ~]# grep HugePages /proc/meminfoAnonHugePages:      8192 kBHugePages_Total:     868HugePages_Free:      868HugePages_Rsvd:        0HugePages_Surp:        0[root@xkan ~]# su - oracle[oracle@xkan ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 14 20:15:30 2017Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to an idle instance.SQL> startupORACLE instance started.Total System Global Area 1803841536 bytesFixed Size                    2254144 bytesVariable Size                  486542016 bytesDatabase Buffers         1308622848 bytesRedo Buffers                    6422528 bytesDatabase mounted.Database opened.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options[oracle@xkan ~]$ grep HugePages /proc/meminfoAnonHugePages:     14336 kBHugePages_Total:     868HugePages_Free:      671HugePages_Rsvd:      668HugePages_Surp:        0[oracle@xkan ~]$


上一篇:CentOS 静态IP分配,提示Error, some other host already uses address解决办法
下一篇:Linux系统dev/shm大小修改
回复

使用道具 举报

内容发布:goodoice| 发布时间:2017-7-10 15:04:22
多学习多多学习多多的学习啊
回复 支持 反对

使用道具 举报

1框架
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表