Skip to main content

Increase SGA in OCI VMDB Systems with Huge Pages Setup

 => Check the number of Huge Pages configured on the server 

[oracle@sitdb ~]$ grep -i huge /etc/sysctl.conf
vm.nr_hugepages=3495
[oracle@sitdb ~]$

[root@sitdb ~]# grep HugePages /proc/meminfo
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
HugePages_Total:    3495
HugePages_Free:      169
HugePages_Rsvd:        4
HugePages_Surp:        0
[root@sitdb ~]#

Which means there are 3495 Huge Pages configured on the server and each page is of size 2 MB or 2048 KB. This will consume 3495 * 2048 KB of RAM memory or 6990 MB of RAM 


=> The parameter USE_LARGE_PAGES in the database if set to ONLY then the SGA's of all databases and ASM in the server put together should be maximum of 6990 MB. If the SGA exceeds this number for example if SGA is set to 13G then database would not start as the huge pages are not available on the server. 

In this scenario, to increase SGA we have to increase huge pages on the server based on the RAM on the server and reboot the server to make the changes persistent and then increase SGA 

Note: PGA will not be allocated from HugePages, so PGA can be increased depending on the amount of free memory available on the server 


=> Now I want to increase the SGA to 11 GB. My server has 15 GB of RAM, so I have set 80% of RAM for HugePages i.e 12GB of RAM 

12 * 1024 * 1024 KB RAM = 12582912 KB RAM 

Each Huge Page size is 2048 KB, so number of huge pages = 12582912 / 2048 = 6144 

[oracle@sitdb ~]$ grep -i huge /etc/sysctl.conf
#vm.nr_hugepages=3495
vm.nr_hugepages=6144
[oracle@sitdb ~]$


=> Reboot the server and verify the changes

[oracle@sitdb ~]$ grep -i huge /proc/meminfo
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
HugePages_Total:    6144
HugePages_Free:     6144
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
[oracle@sitdb ~]$


=> Check the memlock limit of oracle user

I have set it to unlimited. This should be slightly higher than all SGA's run on the server through oracle user

[oracle@sitdb ~]$ grep -i memlock /etc/security/limits.conf
#        - memlock      11000000
grid soft memlock unlimited
grid hard memlock unlimited
oracle soft memlock unlimited
oracle hard memlock unlimited
[oracle@sitdb ~]$


[oracle@sitdb ~]$ ulimit -l
unlimited
[oracle@sitdb ~]$


Note: 

These settings can also be done in a *.conf file under /etc/security/limits.d/ directory. 

Also if there is a *.conf file in /etc/security/limits.d/ that has settings for memlock, setting it up in /etc/security/limits.conf may not work. 

Make sure you check the files /etc/security/limits.d/*.conf files.



=> Now increase SGA

SQL>  alter system set sga_max_size=11g scope=spfile;
System altered.
SQL> alter system set sga_target=11g scope=spfile;
System altered.


=> Restart database and verify SGA

[oracle@sitdb ~]$ srvctl stop database -d SITCDB_dxb1mz
[oracle@sitdb ~]$ srvctl start database -d SITCDB_dxb1mz
[oracle@sitdb ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Fri Aug 26 10:15:19 2022
Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Automatic Storage Management and Real Application Testing options
SQL> show parameter sga
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
allow_group_access_to_sga            boolean     FALSE
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     TRUE
sga_max_size                         big integer 11G
sga_target                           big integer 11G
unified_audit_sga_queue_size         integer     1048576
SQL>


=> check available huge pages 

[oracle@sitdb ~]$ grep HugePages /proc/meminfo
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
HugePages_Total:    6144
HugePages_Free:      522
HugePages_Rsvd:       12
HugePages_Surp:        0
[oracle@sitdb ~]$


=> Huge Page allocation to SGA can be verified in alert log as well


Supported system pagesize(s):
Fri Aug 26 10:13:55 2022
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
Fri Aug 26 10:13:55 2022
     2048K             6144            5634            5634        NONE
Fri Aug 26 10:13:55 2022
 Reason for not supporting certain system pagesizes:
Fri Aug 26 10:13:55 2022
  4K - Large pagesizes only
Fri Aug 26 10:13:55 2022
**********************************************************************






Comments

Popular posts from this blog

Data Safe - Introduction

Oracle Data Safe - Practical Guide Oracle Data Safe learner guide Oracle Data Safe Assess risk, discover sensitive data, audit activity, and mask safely It focuses on what Data Safe helps you do operationally: review security posture, find risky identities, centralize auditing, locate sensitive data, and produce safer non-production copies. Contents 01 Why Data Safe matters 02 Where it fits 03 Capability map 04 Assessments 05 Activity Auditing 06 Discovery and Masking 07 Operating model 08 First 30 days 09 Knowledge check Section 01 Why Data Safe matters Database security work is often fragmented. One process checks configuration drift, another stores audit logs, another team scans for PII, and another team writes masking logic for test refreshes. Data Safe is useful because it turns those separate jobs into one security workflow. Key idea The best way to think about Data Safe is as a control plane for database security posture: assess the target, identify risky accounts, d...

Testing Different Access Paths : Concatenated Index

Oracle Concatenated Indexes - Practical Deep Dive Oracle concatenated index deep dive Concatenated Indexes How composite indexes really work, why column order matters, and when skip scan changes the story Concatenated indexes, also called composite indexes, are easy to explain badly and surprisingly rich to explain well. The usual summary is “Oracle can use the index only when the leading column is present,” but that is only the starting point. To design them properly, you need to think about leading portions, equality versus range predicates, ordering requirements, skip scan eligibility, covering behavior, and whether one composite index can replace several single-column indexes in a given workload. Contents 01 What concatenated indexes are 02 Leading edge and leading portion 03 Why column order matters 04 Skip scan and when it helps 05 Access patterns and plan reading 06 Covering and sort elimination 07 Design rules that actually hold 08 Common mistakes 09 End-to-end demo 1...

Database Replay - Real Application Testing (RAT)

Oracle Database Replay and RAT - Practical Deep Dive Oracle Database Replay deep dive Database Replay and Real Application Testing How to validate upgrades, patches, migrations, and risky changes with real workload behavior Database Replay is one of the most practical risk-reduction tools in the Oracle DBA toolbox. Instead of trusting synthetic benchmarks, isolated SQL tests, or intuition, you capture a real production workload, restore a test system to the same logical starting point, replay that workload, and analyze whether performance, errors, timing, and transactional behavior still look safe. Contents 01 What RAT actually is 02 Why Database Replay matters 03 End-to-end workflow 04 Capture design and prerequisites 05 Preprocess, calibrate, replay 06 Reading the results well 07 Pitfalls and unreplayable work 08 Database Replay vs SPA 09 Practical playbooks 10 Knowledge check Section 01 What Real Application Testing actually is Real Application Testing, usually shortened...