在Linux中配置hugepage可以提高oracle的性能,减少oracle sga的页交换,类似于aix中的lagepage。
下面演示配置hugepage的方法。
系统环境:
OS:CentOS5 x86
Oracle:10.2.0.1
配置过程
[@more@]检查hugepagesize
ora_test@root[/root]> grep Hugepagesize /proc/meminfo Hugepagesize: 4096 kB |
配置分配hugepage的数量
nr_hugepages的计算公式:nr_hugepages>=sga(mb)/Hugepagesize(mb)
ora_test@root[/root]> echo 50 > /proc/sys/vm/nr_hugepages ora_test@root[/root]> sysctl -w vm.nr_hugepages=50 vm.nr_hugepages = 50 ora_test@root[/root]> echo "vm.nr_hugepages=50" >> /etc/sysctl.conf |
检查hugepage的分配情况
ora_test@root[/root]> grep HugePages_Total /proc/meminfo HugePages_Total: 6 |
这里显示的值为6,小于我配置的数量50,所以需要重启
ora_test@root[/root]> reboot Broadcast message from root (pts/1) (Mon Jan 25 09:38:04 2010): The system is going down for reboot NOW! |
重启之后,检查hugepage的分配情况
ora_test@root[/root]> grep HugePages_Total /proc/meminfo HugePages_Total: 50 |
现在确认hugepage已经分配了50个单位(50×4096kb=200mb)
配置oracle用户的memlock
需要修改/etc/security/limits.conf文件,加入标记为红色的两行
计算公式为:>=HugePages_Total×1024,我这里设置了2倍的值,即:2×50×1024=102400
ora_test@root[/root]> cat /etc/security/limits.conf|grep lock # - memlock - max locked-in-memory address space (KB) # - locks - max number of file locks the user can hold oracle soft memlock 102400 oracle hard memlock 102400 |
检查memlock情况
切换到oracle用户身份,使用ulimit -l命令检查memlock情况
ora_test@root[/root]> su - oracle ora_test@oracle[/home/oracle]> ulimit -l 102400 |
启动数据库
ora_test@oracle[/home/oracle]> sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 25 09:50:33 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. idle> startup ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1218292 bytes Variable Size 67111180 bytes Database Buffers 92274688 bytes Redo Buffers 7168000 bytes Database mounted. Database opened. idle> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options |
检查是否已经使用了hugepage
ora_test@oracle[/home/oracle]> grep HugePages_Free /proc/meminfo HugePages_Free: 30 |
这里显示剩余的hugepage为30,小于HugePages_Total(50),证明oracle已经使用了hugepage
--end--
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22049049/viewspace-1030861/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22049049/viewspace-1030861/