Professional Documents
Culture Documents
Products & Services Knowledgebase Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC
performance
Environment
Red Hat Enterprise Linux 7
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 4
Oracle 9g
Oracle 10g
Oracle 11g
Oracle 12c, 18c, 19c
Issue
How can I tune my Red Hat Enterprise Linux system for Oracle 10g/11g?
High memory consumption on Oracle database system
Resolution
The information contained herein is just an example of how the configuration may
look like and is provided just for the convenience only. See Reference section for
additional examples and discussion reguarding tuning.
In the absence of any future documentation from Red Hat specifically for RHEL8, the
recommendations for RHEL7 are also applicable for RHEL8 environments.
Note 353529.1 - Requirements for Installing Oracle 9iR2 64-bit on RHEL 4 x86-
64 (AMD64/EM64T)
Note 390900.1 - Requirements for Installing Oracle 10g (10.1.0.x) RDBMS on
RHEL 4 on AMD64/EM64T (Linux x86-64)
Note 339510.1 - Requirements for Installing Oracle 10gR2 RDBMS on RHEL 4 on
AMD64/EM64T
Note 437123.1 - Requirements for Installing Oracle 11gR1 RDBMS on RHEL 4 on
AMD64/EM64T
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation Asi… 2/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
Note 880942.1 - Requirements for Installing Oracle 11gR2 RDBMS on RHEL (and
OEL) 4 on AMD64/EM64T
2. Automatic configuration
Red Hat provides a RHEL Tuner for Oracle tool to help tune your Red Hat Enterprise Linux
for Oracle. The tool incorporates the information included in this document but makes it
easier to generate valid and support-recommended configurations. You can leave feedback
on the tool at RHEL Tuner for Oracle.
3. Manual configuration
Note: All the numbers mentioned in this article are not generic and have been shown to
have a positive effect on database workloads resident on Red Hat Enterprise Linux.
That being said, the specific values depend on user environments and may require
further adjustment.
Swapping for Oracle is not ideal and should be avoided as much as possible. The
following tunable will tune the kernel to swap less aggressively.
vm.swappiness=10
Maximum percentage of active memory that can have dirty pages. For example if a
system has 1000 pages of memory and dirty_background_ratio is set to 3% ,
writeback will begin when 30 pages have been dirtied.
vm.dirty_background_ratio=3
Maximum percentage of total memory that can have dirty pages. If it is set to 40% on a
1000 page system, a process dirtying pages will be made to wait once the 400th page
is dirtied.This mechanism will, thus, slow the dirtying of pages while the system catches
up.
vm.dirty_ratio=40
vm.dirty_expire_centisecs=500
How often pdflush is activated to clean dirty pages (in hundreds of a second):
vm.dirty_writeback_centisecs=100
HugePages
2. Calculate the recommended number of HugePages using the formula below, using
Hugepagesize and the System Global Area (SGA) values from Oracle. See Oracle
documentation for more about SGA and where to find those values. Note that the
Program Global Area (PGA) does not use huge pages.
The following is an example showing that 10240 is amount of huge pages required
to fit the 20GB SGA. Please note, that values were are all converted to kilobytes for
calculation:
Hugepagesize = 2048 KB
20 GB SGA = 20971520 KB
(20971520 / 2048) = 10240
vm.nr_hugepages=10240
vm.hugetlb_shm_group=<insert oracle group ID here>
4. Once the above setting has been tested and shown to provide the performance
required, it is recommended to move HugePage allocation to the kernel line in grub
configuration as a boot option. This allows for earlier and cleaner allocation of
HugePages:
How to permanently modify the kernel command line in RHEL5 and RHEL6?
If Hugepages are not set in kernel command line, they can be dynamically allocated
by setting the value in nr_hugepages .
When the system is under memory pressure, the huge pages cannot be swapped.
5. Change the Oracle database configuration to use the Huge Pages. Contact Oracle
support if assistance is needed
Note: In order for Oracle database to use Huge Pages in Red Hat Enterprise Linux, you
may also need to increase the ulimit parameter "memlock" for the oracle user in
/etc/security/limits.conf. The memlock setting is specified in KB and must match the
memory size of the number of Huge Pages that Oracle should be able to allocate. So, if
the Oracle database should be able to use 512 Huge Pages, then memlock must be set
to at least (512 * Hugepagesize), which on a default system would be 1048576 KB
(512*2048).
Shared Memory
SHMALL is the maximum total amount of shared memory pages that can be used
system-wide. Hence, SHMALL should always be at least ceil(SHMMAX/PAGE_SIZE) .
SHMMAX is the maximum size in bytes of a single shared memory segment that can
be created.
page=$(getconf PAGE_SIZE)
Calculate 75% of the total memory in the system in pages for SHMALL :
Set the SHMMAX and the SHMALL values in the /etc/sysctl.conf file:
Set the maximum number of shared memory segments with SHMMNI in the
/etc/sysctl.conf file:
Semaphores
The first value, SEMMSL, is the maximum number of semaphores per semaphore set
The second value, SEMMNS, defines the total number of semaphores for the system
The third value, SEMOPM, defines the maximum number of semaphore operations per
semaphore call
The last value, SEMMNI, defines the number of entire semaphore sets for the system
# vi /etc/security/limits.conf
#<domain> <type> <item> <value>
oracle hard nofile 10000
Disabling transparent hugepages (THP) recommended just for Red Hat Enterprise Linux
6 and 7
Example #1:
Example #2:
# tuned-adm off
Note: The tuned-adm command will revert all your settings to what they were before tuned
started and disable the tuning services from running at boot. As an alternative, a customized
tuned profile can be created, taking over the old settings and only disabling THP. Refer to
kbase Disabling transparent hugepages (THP) on Red Hat Enterprise Linux 6 is not taking
effect. for details.
# reboot
I/O scheduler
The default CFQ I/O scheduler is appropriate for most workloads, but does not offer
optimal performance for database environments. Instead, one of the following IO
schedulers should be used:
The deadline scheduler is recommended for physical storage
The noop scheduler is recommended for virtual storage
NUMA balancing
* By default on RHEL7 numa_balancing is enabled. This can see an impact for Oracle
workload so the best practice is to prevent the NUMA balancing.
Reference
2016 - Deploying Oracle RAC Database 12c on Red Hat Enterprise Linux 7 - Best
Practices
2016 - Deploying Oracle Database 12c on Red Hat Enterprise Linux 7- Recommended
Practices
2014 - Red Hat Enterprise Linux 7 - Using Tuned for Tuning an Oracle Workload
2014 - Deploying Oracle Database 12c on Red Hat Enterprise Linux 6
2013 - Deploying Oracle RAC 11g R2 Database on Red Hat Enterprise Linux 6 - Best
Practices
2013 - Deploying Oracle Database 11g R2 on Red Hat Enterprise Linux 6 - Best
Practices
2008 - Deploying Oracle 10g RHEL 5
[1] Metalink is now referenced as "My Oracle Support". This is Oracle's official electronic
online support serves portal. Users will need a valid Oracle support contract in order to login
and read the referenced Notes herein.
the
Product(s)
Red Hat Enterprise Linux Component
kernel Category
Performance tune
Tags
labs_rheltfo
oracle
performance
performance_tuning
rhel_4
rhel_5
rhel_6
rhel_7
This solution is part of Red Hat’s fast-track publication program, providing a huge library of
solutions that Red Hat engineers have created while supporting our customers. To give you
the knowledge you need the instant it becomes available, these articles may be presented in
a raw and unedited form.
Why does Oracle installation is failing with "You are attempting to install 64-bit Oracle
on a 32-bit operating system." ?
41 Comments
17 October 2011 2:55 PM
WJ wjmurcia
30 Points
≤ Reply
David Powles
RED HAT
Thanks for the feedback! I've corrected the article.
GURU
25394 ≤ Reply
Points
NEWBIE If use Huge Page, no need for other vm.* parameters tuning as Huge Page memory
5 Points does not swap.
≤ Reply
COMMUNITY Oracle on MOS 811306.1 actually recommends setting swappiness to 100, what's the
MEMBER
deal ?
46 Points
≤ Reply
PRO Is this a typo and /etc/sysctl.conf was meant? Or if it is a valid file, then can you
2378 please advise the difference with /etc/sysctl.conf
Points
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 10/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
≤ Reply
20 November 2012 3:57 AM
YB Yogesh Babar
RED HAT
Hello,
EXPERT
809 Thanks for catching this, indeed it should be /etc/sysctl.conf. I have corrected the
Points article.
≤ Reply
GURU no worries. Thank you for quick response! and for the article
PRO
2378 ≤ Reply
Points
RED HAT
.
COMMUNITY
MEMBER
57 Points
≤ Reply
COMMUNITY I got a notification saying that this article changed... Is there a way to know what
MEMBER
changed?
96 Points
≤ Reply
Marc Milgram
RED HAT
Ugo,
GURU
1519 That is a great question. I don't know of any way that non-Red Hat associates can
Points see what changed.
I took a look at the changes. The only substantive changes were the
recommendations relating to kernel.sem.
≤ Reply
17 January 2014 11:27 PM
AN annerobbins
NEWBIE Question about the huge pages value calculation: my understanding is that PGA
10 Points does not use huge pages, so why is that included in the calculation? Elsewhere, for
instance on some Oracle sites, I've seen a hugepages_setting.sh script that does its
calculations from ipcs.
≤ Reply
Roger Lopez
RED HAT
Hi Anne,
ACTIVE
CONTRIBUTOR
You are right on the PGA does not use huge pages.The goal of setting up huge
207
Points
pages is to provide the correct number of pages to handle the running shared
memory segments used by the SGA. An easy way to calculate the number of huge
pages without using the hugepages_settings.sh script created by Oracle is to take
the size of your SGA in kilobytes and divide that by the huge page size from the OS.
In RHEL, the page size is 2048 kb. So the calculation would be: SGA in kilobytes /
2048 (huge page size). Once you have this size, you should add a few additional
huge pages just to ensure all of the SGA can fit in large pages. After you have set
this piece up, you also need to set the memlock parameter within your limits.d conf
file located in /etc/security/limits.d/ directory). Setting memlock allows the oracle
user to lock a certain amount of memory from physical RAM that isn't swapped out.
The value is expressed in kilobytes and is important from the Oracle perspective
because it provides the oracle user permission to use huge pages. So the next
question might be how do I know if Oracle is using the huge pages? Well you can
check cat /proc/meminfo and look at the hugepages total and hugepages free and
see how the value goes down when you start your Oracle db instance. The other
place to look is in the Oracle alert log. Within the alert log search for the word
'Large' and you should see something like:
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 12/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
In this example the key line was: Total System Global Area in large pages = 19 GB
(100%) as it shows that the Total SGA is in large pages.
Roger
≤ Reply
Roger Lopez
RED HAT
Forgot to mention, to value of memlock should be slightly bigger than the size of the
ACTIVE
CONTRIBUTOR Oracle SGA in kilobytes.
207
Points ≤ Reply
COMMUNITY Roger, but you didn't explain why RedHat recommmends in this article reserve huge
MEMBER
pages for
22 Points
"+ PGA + (20 KB * # of Oracle processes running)".
But PGA can be huge. And it's advisable parameter - Oracle tries to limit PGA by
pga_aggregate_target, but it cann't guarantee it and it/s normal behaviour.
If you cann't explain it "+ PGA + (20 KB * # of Oracle processes running)" - remove it
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 13/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
from article.
It looks that RedHat doesn't know from where it comes but it leaves it in article.
≤ Reply
Fabio Tavano
COMMUNITY I'm interested too to know why the author of the article (good for the other aspects)
MEMBER
take in account also PGA and number of oracle processes.
47 Points
Regards
≤ Reply
NEWBIE Thank you very much for your responses. A couple of questions: Any strong reason
10 Points not to set memlock for Oracle to unlimited (as shown in your log example)? Is there
a really great risk of Oracle getting out of hand and fixing more memory than its
SGA? This would certainly reduce the need to change this setting every time SGA is
increased.
And, yes, I have seen at least one of your articles mentioned above, which brings me
to my next question. A couple of the settings you recommend differ significantly
from those in this article, the most dramatic difference being dirty_pages_ratio,
which you recommend raising significantly from the default, while this article
recommends lowering it. Did you specifically have RH 6 in mind when you made that
recommendation - would you make the same recommendation for RH 5? I have
seen the KB article 348683 that seems to imply that the setting should be done in
bytes, not ratio, if using huge pages at RH 5 - another thing on the to-do list for
huge pages?
≤ Reply
Roger Lopez
RED HAT
Hi Anne,
ACTIVE
CONTRIBUTOR
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 14/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
207 I'm not sure why the log shows the memlock value as unlimited, because I definitely
Points have a value set. I don't think there is a great risk of Oracle getting out of hand and
fixing more memory than its SGA. Oracle is just looking to see if large pages are
available and if it can accommodate all the memory of the SGA into large pages. As
for the value set for memlock, I'd set it to slightly larger than what you believe will be
your largest SGA at any point in time. This way all your use cases with a smaller SGA
are taken care of.
With regards to the dirty_ratio, the reason I increased the value from what you
normally see as 15 to 80 is based on my understanding of dirty ratio. Dirty ratio
defines the maximum percentage of total memory that can be filled with dirty pages
before user processes are forced to write dirty buffers themselves during their time
slice instead of being allowed to do more writes. Note that all processes are blocked
for writes when this happens, not just the one that filled the write buffers. This can
cause what is perceived as an unfair behavior where a single proces can hog all the
I/O on a system. However, an application that can handle their writes being blocked
altogether might benefit from decreasing the value.
The biggest thing I want to point out about kernel parameters in general is that
there is no perfect answer. Every workload is different and requires performance
testing. These values should just be seen as a starting point for your workload. The
behavior of this parameter to my knowledge is the same for RHEL5 and RHEL6 so it
would apply to both distributions.
Hope that helps and if you have any other questions feel free to ask :)
Take care,
Roger
≤ Reply
RED HAT
The grub modification can be done by issuing the following command:
ACTIVE
CONTRIBUTOR grubby --update-kernel=ALL --args="transparent_hugepage=never"
268
Points
(via eminguez)
≤ Reply
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 15/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
COMMUNITY HugePages:
MEMBER
Missed the line in sysctl.conf,
30 Points
without mentioned oracle/dba group id, oracle user not able to access the huge
pages.
vm.huge_tlb_shm_group = gid
≤ Reply
totmem=$(echo "$mem1024"|bc) # B
max=$(echo "$totmem75/100"|bc) # B
HugePages in KiB
all=$(echo "$max/$huge"|bc)
So in the above calculation you have B / KiB .. i think $huge should also be put into
the same metrics (Bytes).. (times $huge by 1024)
≤ Reply
NEWBIE kernel.shmall is measured in "pages". In the summit notes and this guide it is
17 Points assumed the pages is 2MiB (that is why you divide by 'hugepagesize'). When i set
the value in /etc/sysctl.conf and use ipcs -l to confirm the new size i find that the
O/S is multiplying the value in a page size of 4KiB rather than 2MiB.
Any guidance on how to set and check shared memory values when hugepages is in
use?
≤ Reply
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 16/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
COMMUNITY
MEMBER
1. Calculate the recommended number of HugePages using the formula
22 Points below, using Hugepagesize and >the System Global Area (SGA) and
Program Global Area (PGA) values from Oracle. See Oracle
>documentation for more about SGA and PGA, and where to find those
values:
Why we reserve hugepages for PGA and for (20 KB * # of Oracle processes
running) ?
Oracle stated that hugepages are used only for SGA(shared memory).
≤ Reply
COMMUNITY Some of the recommended values differ from at least one of the referenced articles,
MEMBER
like https://access.redhat.com/articles/395013, which we have been following. Which
29 Points
article do we follow and why? Is the intent of this one to correct the previous?
≤ Reply
RED HAT
The solution does not mention the environment of Red Hat Enterprise Linux 7. Is it
ACTIVE
CONTRIBUTOR not verified?
103 Points
≤ Reply
COMMUNITY Is it me or this KB solution article looks totally not professionnal? Tons of comments,
MEMBER
but we don't know it's valid or not, or included in the article or not. Also, there is no
96 Points
way to know what has been edited since the last version of the article. I recive
notifications when it changes, but have no idea what changes every time.
≤ Reply
Ugo Bellavance
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 17/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
Isn't there a way to keep tuned enabled, but have it disable transparent huge pages?
UB See here: https://access.redhat.com/sites/default/files/attachments/deploying-
oracle-11gr2-rac-on-rhel6_1.1.pdf
COMMUNITY
MEMBER
By the same token, why not integrate this article in this document, once all the
96 Points
parameters are validated?
≤ Reply
COMMUNITY
MEMBER Gi Kim
93 Points
75% of System Memory in bytes
totmem=$(echo "$mem1024"|bc) # B
max=$(echo "$totmem75/100"|bc) # B
HugePages in KiB
all=$(echo "$max/$huge"|bc)
So in the above calculation you have B / KiB .. i think $huge should also be put
into the same metrics (Bytes).. (times $huge by 1024)"
I do not believe you can divide Bytes by KB. It is a simple maths rule.
Furthermore if you were to convert the huge page size to Bytes, the value of shmall
would be way too small.
Also, every other article in RH KB and on the internet use the system page size
(4096 Bytes) for this calculation.
Thanks
≤ Reply
RED HAT
Well spotted! I have corrected this calculation so that like-units carry through the
EXPERT
calculation. This should be a much more correct resulting value for the shmmax
tunable (measured in bytes)
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 18/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
1005
≤ Reply
Points
#free -h
total used free shared buffers cached
Mem: 19G 18G 826M 4.9G 397M 16G
-/+ buffers/cache: 1.9G 17G
Swap: 49G 0B 49G
#free -b
total used free shared
buffers cached
Mem: 2095443148 2008875008 865681408 5300641792 416825344
1759333171
-/+ buffers/cache: 2078593024 1887583846
Swap: 5368289280 0
5368289280
In this case, 19GB = 20954431488 bytes but free -b shows 2095443148 bytes (note
the missing 8 at the end).
Thanks
≤ Reply
55 Points
≤ Reply
NEWBIE System Z
9 Points
≤ Reply
COMMUNITY There is now a tuned-profiles-oracle package for RHEL6 and 7. I think the article
MEMBER
should be updated to reflect tuned's usage.
96 Points
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 19/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
≤ Reply
NEWBIE It seems that this guide isn't quite in sync with the tuned profile provided by tuned-
12 Points profiles-oracle in EL 6.8 and higher. Which is the more up-to-date resource?
≤ Reply
ACTIVE Here is a question for the community: Would it break Oracle to make all the
CONTRIBUTOR
associated user accounts as system accounts that one cannot log in as (directly) ?
253
Points
≤ Reply
COMMUNITY Can somebody pls confirm if I can straightaway change the IO scheduler from CFQ
MEMBER
to Deadline? We are running 12c RAC on RHEL 6 and I strongly suspect there is IO
65 Points
slowness. Reason being, in the lab systems we get much better performance but
that is on RHEL 7 (default IO scheduler is Deadline) whereas production is on RHEL
6 and IO is slow. Thanks
≤ Reply
RED HAT
Yes you can change the scheduler on the running system, just run:
ACTIVE
CONTRIBUTOR
echo 'deadline' > /sys/block//queue/scheduler
172 Points
And verify with:
cat /sys/block//queue/scheduler
≤ Reply
COMMUNITY
MEMBER
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 20/22
26/10/2021, 16:13 Tuning Red Hat Enterprise Linux for Oracle and Oracle RAC performance - Red Hat Customer Portal
65 Points Thanks Ben. I do understand that IO scheduler can be changed on a running system.
I should have worded my question more appropriately. Let me re-phrase: This KB
states "The default CFQ I/O scheduler is appropriate for most workloads, but does
not offer optimal performance for database environments. Instead, one of the
following IO schedulers should be used:
The deadline scheduler is recommended for
physical systems"
Given that ours is a physical system, can I, rather, should I change
it in production considering it as a 'given' i.e. without really verifying or should I take
some stats and verify first before making that change? Reason being, I strongly
suspect that the IO on my production is slow. This is because when I run the same
workload in labs I dont see await times as high as in production. I have gone through
KB https://access.redhat.com/solutions/54164 and the symptons mentioned in it do
not match. So iostat o/p does not help me conclude very clearly if CFQ is the issue
and deadline will solve the IO slowness. Even if does not solve, as far as it wont harm,
I am ok.
for e.g. I analyzed the iostat o/p using various different commands (iostat -
dkNx 2 600, iostat -tkx 2 600, iostat -dmzx 2 600) but I always see rrqm/s &
wrqm/s as 0. However, RHEL 7 has made Deadline as the default scheduler which
kind of, further confirms that it is better as compared to CFQ. Even Oracle EL has
Deadline as the default. So given that iostat is not helping to conclude but since this
KB and various other articles on the internet suggest deadline for Oracle databases,
I wanted to know if I can go ahead making that change in prod.
Many Thanks
≤ Reply
GURU Is there an update of this article for Oracle 18 and RAC 18?
11998
Points ≤ Reply
≤ Reply
Alexay Ivanov
GURU Hi Alexay,
11998
Points The automatic config generator supports RHEL 8.
Regards,
Jan Gerrit
≤ Reply
https://access.redhat.com/solutions/39188?band=se&seSessionId=ee577279-9c14-41a6-8392-0214edbd80fe&seSource=Recommendation A… 22/22