HugePages

SQL> show parameter sga

NAME                                       TYPE       VALUE
------------------------------------ ----------- ------------------------------
lock_sga                                    boolean       FALSE
pre_page_sga                            boolean       FALSE
sga_max_size                            big integer    20G
sga_target                                  big integer    20G
SQL>

20 x 1024 = 20480 (20GB)

oracle 11g RDBMS: grep Huge /proc/meminfo -
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB

20480 x 1024 = 20971520
20971520 / 2048 = 10240

-Set Huge Page Pool size (UNIX)

edit /etc/sysctl.conf
vm.nr_hugepages = Z
vm.nr_hugepages = 10246 (+ extra 6)

sudo sysctl -p /etc/sysctl.conf

[root@test etc]# grep Huge /proc/meminfo
AnonHugePages: 0 kB
HugePages_Total: 10246
HugePages_Free: 10246
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB

confirm /etc/security/limits.conf

-Check the permissions to access System large pages
-log out/in as oracle
-Turn of 11g Mem management

SQL> alter system set memory_target=0 scope=spfile;

System altered.

SQL> alter system set memory_max_target=0 scope=spfile;

System altered.

SQL> alter system set use_large_pages="only" scope=spfile;

System altered.

SQL> alter system set sga_max_size=20480M scope=spfile;

System altered.

SQL> alter system set sga_target=20480M scope=spfile;

SQL> shutdown immediate
SQL> startup mount

## may get this error

ORA-27137: unable to allocate large pages to create a shared memory segment
Linux-x86_64 Error: 1: Operation not permitted

## alert log

Starting ORACLE instance (normal)
Memlock limit too small: 65536 to accommodate segment size: 134217728
****************** Large Pages Information *****************
Parameter use_large_pages = only

Large Pages unused system wide = 13230 (26 GB) (alloc incr 64 MB)
Large Pages configured system wide = 13230 (26 GB)
Large Page size = 2048 KB

ERROR:
Failed to allocate shared global region with large pages, unix errno = 1.
Aborting Instance startup.
ORA-27137: unable to allocate Large Pages to create a shared memory segment

ACTION:
Check the permissions to access System large pages
***********************************************************

## increase the ulimit parameter "memlock" for the oracle user in /etc/security/limits.conf - restart DB

Restart DB

Starting ORACLE instance (normal)
****************** Large Pages Information *****************
Parameter use_large_pages = only

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

Large Pages used by this instance: 10241 (20 GB)
Large Pages unused system wide = 5 (10 MB) (alloc incr 64 MB)
Large Pages configured system wide = 10246 (20 GB)
Large Page size = 2048 KB
***********************************************************