High Swap Usage On Oracle Database Server

SITUATION

When investigating into client’s Oracle database performance issue, we found the swap space usage is constantly very high on this Linux server.

OS: RHEL 7.3
DB: Oracle 12.2.0.1

FINDINGS

1)top
Tasks: 352 total, 2 running, 350 sleeping, 0 stopped, 0 zombie
Cpu(s): 13.4%us, 4.1%sy, 0.0%ni, 79.3%id, 2.2%wa, 0.3%hi, 0.8%si, 0.0%st
Mem: 32172820k total, 32015956k used, 156864k free, 14528k buffers
Swap: 16777208k total, 7435428k used, 9341780k free, 11129844k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
137049 oracle 15 0 16.2g 5.3g 5.3g S 20.6 17.4 10:14.17 oracle
 72457 oracle 15 0 16.2g 4.7g 4.7g S 15.3 15.3 10:50.15 oracle
...
..
.
2) pmap
$ pmap -x 137049
137049: oracleRACTEST1 (LOCAL=NO)
Address          Kbytes   RSS     Dirty Mode Mapping
0000000000400000 96356    11704   0     r-x-- oracle
0000000006419000 444      140     4     rwx-- oracle
0000000006488000 148      100     80    rwx-- [ anon ]
000000001966e000 532      176     92    rwx-- [ anon ]
0000000060000000 16779264 5444888 1485768 rwxs- [ shmid=0x670005 ]
00000032b6a00000 112      108     0     r-x-- ld-2.5.so
00000032b6c1c000 4        0       0     r-x-- ld-2.5.so
...
..
.
00007fff4c504000 160 136 132 rwx-- [ stack ]
00007fff4c5d2000 12 4 0 r-x-- [ anon ]
ffffffffff600000 8192 0 0 ----- [ anon ]
---------------- ------ ------ ------
total kB 16954204 5477952 1490448
3) swappiness
$ cat /proc/sys/vm/swappiness
10

Subscribe to get access

Read more of this content when you subscribe today.

How To Flush DNS Cache

Basic command for DBA to flush DNS cache.

To flush DNS cache in Microsoft Windows :

C:>ipconfig /flushdns

To flush the DNS cache in Linux:

# /etc/rc.d/init.d/nscd restart

To flush the DNS cache in Mac OS X Leopard:

$ lookupd -flushcache

To flush the DNS cache in Mac OS X:

$ dscacheutil -flushcache

Certainly rebooting your computer always works.

How to Install rlwrap on Linux

Great utility to arrow UP/DOWN to choose the history commands as in DOS environment.

rlwrap is an utility that allows you to use up and down arrows like in DOS environment. For Oracle commands like sqlplus, rman, adrci, we can do the same as in DOS environment to choose one of the history command instead of type the same command again.

1) Downloand and install as a package from “http://rpm.pbone.net/” or an alternative web sites.

2) Yum install automatically.

[root@racnode1 Patches]# yum install rlwrap-0.42-1.el7.x86_64.rpm
Loaded plugins: langpacks
Examining rlwrap-0.42-1.el7.x86_64.rpm: rlwrap-0.42-1.el7.x86_64
Marking rlwrap-0.42-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rlwrap.x86_64 0:0.42-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package Arch Version Repository Size
======================================================================================================================================================
Installing:
 rlwrap x86_64 0.42-1.el7 /rlwrap-0.42-1.el7.x86_64 209 k

Transaction Summary
======================================================================================================================================================
Install 1 Package

Total size: 209 k
Installed size: 209 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : rlwrap-0.42-1.el7.x86_64 1/1 
 Verifying : rlwrap-0.42-1.el7.x86_64 1/1 

Installed:
 rlwrap.x86_64 0:0.42-1.el7 

Complete!

# which rlwrap
/bin/rlwrap

3) In $HOME/oracle/ .bash_profile, define aliases similar as below to make rlwrap enabled for the commands you want:

# Fo Oracle DB
alias sqlplus=”rlwrap sqlplus”
alias dgmgrl=”rlwrap dgmgrl”
alias rman=”rlwrap rman”
alias lsnrctl=”rlwrap lsnrctl”
alias asmcmd=”rlwrap asmcmd”
alias adrci=”rlwrap adrci”
alias impdp=”rlwrap impdp”
alias expdp=”rlwrap expdp”
# For GoldenGate
alias ggsci='rlwrap ./ggsci'

4) You can use UP/DOWN to choose the history commands as in DOS environment from now on.

Wish you enjoy this new utility for Linux !

Setting Shell Limits For Grid and Oracle Users

This post advises how to set resources limit correctly.

ulimit is to provide control over system resources. Setting limits to allow the user to use resources as much as really needed, so the system resources can be shared by all users fairly.

There are different ways and different places (/etc/security/limits.conf, /etc/profile, etc ) for setting shell limits, which are easily overlooked and confused by DBA.

This post will explain how to setup shell limits properly and correctly.

Subscribe to get access

Read more of this content when you subscribe today.