对于内存较大的Oracle数据库服务器,配置HugePage是很有必要的,下面是配置Huge的步骤:

我的环境:

OS:CentOS release 6.4 (Final)

Oracle:11.2.0.4 RAC

1.设置memlock

编辑/etc/security/limits.conf

增加:

* Soft memlock稍小于RAM值

* hard memlock稍小于RAM值

Memlock值大于sga没关系的,所以我们可以设置这个值在我们想要的SGA size和物理内存size之间,这个值得单位是kb。

[root@node1 ~]# grep -i memtot /proc/meminfo

MemTotal:       132250576 kB

我们物理内存大小126G,因此我可以设置memlock为100G。

在2个节点设置:

[root@node1 ~]# tail -2 /etc/security/limits.conf

* soft memlock 104857600

* hard memlock 104857600

设置完毕后,以Oracle用户登录验证:

node2-> ulimit -l

104857600

2. 禁用AMM特性:

禁用AMM特性需要将memory_max_target, memory_max_target2个参数重置,而不仅仅是设置为0,最好的办法是创建一个pfile,在pfile中将这2个参数删除,再根据这个pfile创建spfile.

主要内存参数设置为:

node1->

node1-> grep target /tmp/init.ora

*.pga_aggregate_target=1572864000

*.sga_target=64424509440

SQL> create spfile from pfile='/tmp/init.ora';

File created.

SQL> startup force

ORA-27102: out of memory

Linux-x86_64 Error: 28: No space left on device

Additional information: -134217728

Additional information: 1

SQL>

出现这个报错是因为shmall设置的太小。

Shmall表示共享内存的总大小,单位为pagesize的大小。

根据我的配置,最大能支持8G的SGA:

node1-> getconf PAGE_SIZE

4096

node1->  cat /proc/sys/kernel/shmall

2097152

修改shmall并重新启动数据库,修改的方法很简单,编辑/etc/sysctl.conf:

kernel.shmall= 16252928

即可。

修改完毕kernel.shmall,此时可以重启数据库。

SQL> startup nomount pfile='/tmp/init.ora';

ORACLE instance started.

Total System Global Area 6.4137E+10 bytes

Fixed Size                  2269072 bytes

Variable Size            6979321968 bytes

Database Buffers         5.7043E+10 bytes

Redo Buffers              112762880 bytes

SQL>

SQL>

DB启动后重新创建spfile:

SQL>  create spfile='+OCR/sszgdb/spfilesszgdb.ora' from pfile='/tmp/init.ora';

File created.

SQL>

3.         根据Oracle的脚本计算hugepage大小(计算时要确保Oracle已经启动),也可自己计算:

Press Enter to proceed...

Recommended setting: vm.nr_hugepages = 30739

node1->

4.         根据脚本的计算值在2个节点编辑/etc/sysctl.conf

加入vm.nr_hugepages = 30739

[root@node2 ~]# grep -i huge /proc/meminfo

AnonHugePages:    602112 kB

HugePages_Total:   30739

HugePages_Free:    30739

HugePages_Rsvd:        0

HugePages_Surp:        0

Hugepagesize:       2048 kB停止数据库实例

5.         重启服务器,一般重启服务器之后DB也自动启动了。服务器和DB重启后可以通过以下命令验证大页的使用情况:

grep -i Hugepages /proc/meminfo

此时查看Oracle的alert日志,也可以发现:

Starting ORACLE instance (normal)

************************ Large Pages Information *******************

Per process system memlock (soft) limit = UNLIMITED

Total Shared Global Region in Large Pages = 58 GB (96%)

Large Pages used by this instance: 29761 (58 GB)

Large Pages unused system wide = 24 (48 MB)

Large Pages configured system wide = 30739 (60 GB)

Large Page size = 2048 KB

RECOMMENDATION:

Total System Global Area size is 60 GB. For optimal performance,

prior to the next instance restart:

1. Increase the number of unused large pages by

at least 936 (page size 2048 KB, total size 1872 MB) system wide to

get 100% of the System Global Area allocated with large pages

可以发现sga并没有全部放在大页里,这样可能对性能带来负面影响,Oracle建议我们再加入936个大页,可见Oracle的大页脚本计算并不准确,我们需要增加大页数量,并设置参数Use_large_pages=only,该参数确保Oracle的共享内存全部使用大页。

再重启DB,此时alert日志:

************************ Large Pages Information *******************

Parameter use_large_pages = ONLY

Per process system memlock (soft) limit = 100 GB

Total Shared Global Region in Large Pages = 60 GB (100%)

Large Pages used by this instance: 30721 (60 GB)

Large Pages unused system wide = 0 (0 KB)

Large Pages configured system wide = 31675 (62 GB)

Large Page size = 2048 KB

可以发现sga全部使用了大页了。

另需确保环境变量DISABLE_HUGETLBFS unset,该变量会禁用Oracle使用Hugepage

附:计算HugePage大小的脚本:

#!/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.

#

# This script is provided by Doc ID 401749.1 from My Oracle Support

# http://support.oracle.com

# Welcome text

echo "

This script is provided by Doc ID 401749.1 from My Oracle Support

(http://support.oracle.com) where it is intended to compute values for

the recommended HugePages/HugeTLB configuration for the current shared

memory segments. 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 -m

Press Enter to proceed..."

read

# Check for the kernel version

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

# Find out the HugePage size

HPG_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 1

fi

# Initialize the counter

NUM_PG=0

# Cumulative number of pages required to handle the running shared memory segments

for 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`

fi

done

RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`

# An SGA less than 100MB does not make sense

# Bail out if that is the case

if [ $RES_BYTES -lt 100000000 ]; then

echo "***********"

echo "** ERROR **"

echo "***********"

echo "Sorry! There are not enough total of shared memory segments allocated for

HugePages configuration. HugePages can only be used for shared memory segments

that you can list by command:

# ipcs -m

of 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 1

fi

# Finish with results

case $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" ;;

esac

# End

linux带page参数报错,Linux配置hugepage相关推荐

  1. linux线程超过1024报错,Linux定位c++程序运行异常的经历《实操》

    对于c++程序来说,以segment fault为代表的程序异常行为千奇百怪,没有一套比较丰富的工具集去对付他们,在处理实际问题时就会显得捉襟见肘.本文列举几种程序异常的定位方法. 子线程创建不出来 ...

  2. linux安装vnc服务报错,Linux安装vnc server

    操作系统: centos7.6 需求: 安装并配置vnc server 参考: https://blog.csdn.net/absenceoftrace/article/details/5188203 ...

  3. linux安装多路径报错,Linux操作系统配置多路径通用教程(适用于(RHEL,CentOS,SuSE等)...

    Linux操作系统配置多路径通用教程(适用于(RHEL,CentOS,SuSE等) 猫先生 • 2019 年 06 月 01 日 一,安装软件 1,执行以下命令,检查当前系统中是否已经安装多路径工具: ...

  4. linux u盘 启动报错,linux U盘启动系统的绘制

    brw-r----- 1 root disk 8, 32 10-16 15:50 /dev/sdc brw-r----- 1 root disk 8, 36 10-16 15:50 /dev/sdc4 ...

  5. linux输入ls命令报错,Linux命令基础2-ls命令

    本文介绍的是linux中的ls命令,ls的单词是list files的缩写,意思的列出目录文件. 首先我们在admin用户的当前路径,新建一个test的文件夹,为了方便本文操作和介绍,创建了不同文件类 ...

  6. linux重启was控制台报错,Linux非WAS部署,启动报错Cannot run program \lsb_release\

    Linux非WAS部署,启动报错Cannot run program "lsb_release" 已确认 tools.jar 文件是当前 linux 中的 jdk 下的 jar 文 ...

  7. linux 复制硬盘 启动报错,linux挂载硬盘报错(you must specify the filesystem type)

    今天自己的虚拟机磁盘用完成,于是想加一磁盘,当挂载时发现报错you must specify the filesystem type.(注:我的系统环境是lcentos6.3装在virtualbox的 ...

  8. linux进入vi编辑报错,Linux Vi编辑器的使用及C编程

    实验3  Vi编辑器的使用及C编程 一.实验要求 (1)掌握Vi的三种运行模式及切换方法: (2)掌握使用Vi的各种操作命令进行文本文件的编辑: (3)用Vi编写Linux下C程序,掌握gcc编译. ...

  9. linux中make命令报错,Linux命令make报错总结

    Linux环境报错原因.解决方法记录(逐步总结) 1:/bin/sh: lex: command not found make[1]: Leaving directory `/home/ksj/tes ...

  10. linux安装多路径报错,linux多路径软件rdac安装方法

    RDAC安装方法 首先把rdac的源文件拷贝到服务器上,rdac可以从管理软件SANtricity中的光盘中取得Rdac的安装需要系统装好make,gcc等编译工具,此外还需要安装kernel-dev ...

最新文章

  1. [转载]Emmet使用手册
  2. DataRabbit 轻量的数据访问框架(13)--DataRabbit 3.0 ORM性能大幅度提升!
  3. 中国和英国的旅行的对比
  4. python b64encode_Python base64模块详解 | 学步园
  5. 六年级下计算机课ppt课件ppt课件,信息技术六年级《第7课 机器人沿线行走》ppt课件(苏科版)...
  6. 如何使用ABAP代码反序列化JSON字符串成ABAP结构
  7. IOS设置导航栏返回按钮,并添加事件返回主页面
  8. ueditor百度富文本编辑器linux下报错: class path resource [config.json] cannot be resolved to absolute file path
  9. CCF认证-2014-12-2 Z字形扫描
  10. 如何解决在Windows Server 2008 R2 上安装证书服务重启后出现 CertificationAuthority 91错误事件...
  11. 7.Linux/Unix 系统编程手册(上) -- 内存分配
  12. EOS与ESD的区别
  13. 你有被代理过吗?讲讲开源框架都在用的代理模式
  14. Android音视频基础知识
  15. 教你在线免费PDF转Word,建议收藏
  16. unity3d 毛笔笔锋
  17. 蓝底换白底边缘不干净_蓝底换白底【解决措施】
  18. 去水印软件哪个好_去水印工具
  19. 计算机应用课程设计样式大全,《计算机应用基础》课程设计
  20. 反演地表温度空白或者是DN值无穷大+公式

热门文章

  1. 4. 计算机科学 (Kaggle项目拆解:泰坦尼克号预测)
  2. 聊天系统服务器端类图,使用Java多线程来实现多人聊天室 附实例代码
  3. 技术创新是场寂寞的长跑
  4. 不要因为错爱而寂寞一生
  5. Android Camera 预览及录制视频 附demo
  6. IPAD上访问WINDOWS环境远程桌面---三款软件比较
  7. 晨光计算机里的铃声是什么歌曲,soul app里的音乐有哪些?soul app里的铃声有哪些?[图]...
  8. 【ML特征工程】第 6 章 :降维:用 PCA 压缩数据薄饼
  9. 接入网+承载网+核心网
  10. elementUI中的Backtop回到顶部