[oracle@mydb admin]$ chmod +x hugepages_settings.sh
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...
Recommended setting: vm.nr_hugepages = 1028
gyj@OCM> show parameter sga_max_size
5、设置hugepages,在内核参数中添加一行,vi /etc/sysctl.conf
vm.nr_hugepages = 1028
6、修改内核参数立即生效
net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 fs.file-max = 6815744 vm.nr_hugepages = 1028
[root@mydb ~]# vi /etc/security/limits.conf
oracle soft memlock 2056000
8、检查limits是否正确
9、重启数据库---注原来的orale用户的窗口退到root用户,重新su - oracle
sys@OCM> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@mydb ~]$ exit logout You have new mail in /var/spool/mail/root [root@mydb ~]# su - oracle [oracle@mydb ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Thu Dec 5 10:56:20 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options sys@OCM> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. sys@OCM> startup ORACLE instance started. Total System Global Area 2137886720 bytes Fixed Size 2230072 bytes Variable Size 1409288392 bytes Database Buffers 603979776 bytes Redo Buffers 122388480 bytes Database mounted. Database opened.
[oracle@mydb ~]$ watch -n1 'cat /proc/meminfo |grep -i HugePage'
Every 1.0s: cat /proc/meminfo |grep -i HugePage Thu Dec 5 11:09:06 2013 HugePages_Total: 1028 HugePages_Free: 869 HugePages_Rsvd: 842 Hugepagesize: 2048 kB
系统承诺给Oracle预留842页,即842*2M=1684M(1684+118==SGA_MAX_SIZE)
sys@OCM> alter system set pre_page_sga=true scope=spfile; System altered. sys@OCM> show parameter sga NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ lock_sga boolean FALSE pre_page_sga boolean TRUE sga_max_size big integer 2G sga_target big integer 1G
For 11.2.0.2 and further, th