oracledba.help
Install

Linux System Prep for Oracle

Overview

What follows are all the common steps to prep a Linux 7.x\8.x system (RHEL, CentOS, Oracle Linux) to use Oracle Grid Infrastructure or Database.

Oracle's Preinstallation rpm is useful to ensure things dont fall through cracks but is not complete. It is a good starting place for prepping a Linux system for Oracle.

Prerequisites

  • You have downloaded required install files:
    • Oracle Database 21c\19c\18c\12c Database for Linux x86-64.
    • Oracle Database 21c\19c\18c\12c Infrastructure for Linux x86-64 (if RAC).
  • If RAC, all systems must be running the exact same Linux kernel version.
  • RAM 4gb (test) or more. 32 gb+ (production).
  • Required disks provided by your SA so they can be seen by the LINUX OS.
/      = OS and SWAP        (128 gb+)
/u01   = Oracle Data        (size as needed for your database)  
/u02   = FRA, RMAN, Exports (size as needed for your database)
The above assumes you are running on a modern SAN with adequate performance.

If using LINUX then dont use Automatic Memory Management (AMM) and the corresponding memory_target\memory_max_target parameters. This is because "The use of AMM is absolutely incompatible with [Linux] HugePages" -Oracle.

Use Automatic Shared Memory Management (ASMM) by setting the SGA_MAX_SIZE/SGA_TARGET and PGA_AGGREGATE_TARGET parameters. See Doc ID 749851.1 and Doc ID 361468.1.

Furthermore, you dont need to be concerned with allocating explicit resources to tmpfs (/dev/shm) when using HugePages and ASMM.

Create Groups and Users

The following is derived from the Oracle docs. Perform as the root user unless indicated otherwise.

Oracle recommends that you create one software owner to own each Oracle software product:

  • oracle for the database software owner user and
  • grid for Oracle Grid Infrastructure.

Groups

 groupadd --gid 54321 oinstall
 groupadd --gid 54322 dba
 groupadd --gid 54323 asmdba
 groupadd --gid 54324 asmoper
 groupadd --gid 54325 asmadmin
 groupadd --gid 54326 oper
 groupadd --gid 54327 backupdba
 groupadd --gid 54328 dgdba
 groupadd --gid 54329 kmdba
 groupadd --gid 54330 racdba

Oracle's Preinstallation rpm creates dba and oinstall groups.

oracle User

 useradd --uid 54321 --gid oinstall --groups dba,oper,asmdba,asmoper,backupdba,dgdba,kmdba oracle
 passwd oracle

Oracle's Preinstallation rpm creates the oracle user account.

 If oracle user already exists:
   usermod -a -G dba,oper,asmdba,asmoper,backupdba,dgdba,kmdba oracle
   usermod -g oinstall oracle

grid User

 useradd --uid 54322 --gid oinstall --groups dba,asmadmin,asmdba,asmoper grid
 passwd grid

You must have user and system equivalency in a Oracle cluster environment. User equivalency exists in a cluster when the following conditions exist on all nodes in the cluster:

  • A given user has the same user name, user ID (UID), and password.
  • A given user belongs to the same groups.
  • A given group has the same group ID (GID).

For all the GI systems the Linux kernel version and core OS files need to be the same.

After the initial installation GI systems should not be upgraded without a compelling reason (kernel-wise). This is because many cluster and associated drivers need to be re-linked and compiled after a kernel upgrade.

OS Configuration Changes

Set Hostname

  1. Replace the old hostname with the desired one if present:
    • vi /etc/hosts
    • vi /etc/sysconfig/network
  2. Run: hostnamectl set-hostname <YourHostName>
  3. Restart System: shutdown -r now

Confirm:

  1. echo $HOSTNAME
  2. Run: hostname

Disable the zeroconf

  • Edit: /etc/sysconfig/network
  • Add\set this entry: NOZEROCONF=yes

Stop Firewall

systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
service iptables stop
chkconfig iptables off

Edit Host Files: /etc/hosts

127.0.0.1 localhost.localdomain localhost
<ThisSystemsIP> <ThisSystemsFQDN> <ThisSystemsHostName>

Edit tmpfs: /dev/shm <=DEPRECATED

"The use of AMM is absolutely incompatible with [Linux] HugePages" -Oracle. You dont need to be concerned with allocating explicit resources to tmpfs (/dev/shm) when using HugePages and ASMM.
The value of /dev/shm must be larger than you MEMORY_TARGET value. For instance, if you want your database to use 2048m you could set /dev/shm to 2304m

  • Short Term: mount -t tmpfs shmfs -o size=2304m /dev/shm
  • Permanently: vi /etc/fstab and add this entry:
  • shmfs /dev/shm tmpfs size=2304m 0
  • Display Current Value: df -h

Edit Kernel Parameters: /etc/sysctl.conf

Add any values to the end if they dont exist.

 fs.aio-max-nr = 1048576
 fs.file-max = 6815744
 kernel.shmall = 29670075
 kernel.shmmax = 67515904000
 kernel.shmmni = 4096
 kernel.sem = 250 32000 100 128
 net.ipv4.conf.all.rp_filter = 2
 net.ipv4.ip_local_port_range = 9000 65500
 net.core.rmem_default = 262144
 net.core.rmem_max = 4194304
 net.core.wmem_default = 262144
 net.core.wmem_max = 1048576
 kernel.panic_on_oops = 1

 vm.swappiness = 1
 vm.dirty_background_ratio = 3
 vm.dirty_ratio = 80
 vm.dirty_expire_centisecs = 500
 vm.dirty_writeback_centisecs = 100
  • Changes made by Oracle's Preinstallation rpm grayed out.
  • Apply changes: /sbin/sysctl -p

If Individually Preferred

 net.ipv4.conf.eth0.rp_filter = 2
 net.ipv4.conf.eth1.rp_filter = 2

Change eth0 and eth1 with your private interface names.

New values Used in 19c rpm

 kernel.shmall = 1073741824
 kernel.shmmax = 4398046511104
 net.ipv4.conf.default.rp_filter = 2

Edit Limits File: /etc/security/limits.conf

Add any values to the end if they dont exist.

grid          soft    nproc   2047
grid          hard    nproc   16384
grid          soft    nofile  1024
grid          hard    nofile  65536
grid          soft    stack   10240
grid          hard    stack   32768
oracle        soft    nproc   2047
oracle        hard    nproc   16384
oracle        soft    nofile  1024
oracle        hard    nofile  65536
oracle        soft    stack   10240
oracle        hard    stack   32768
oracle        soft    memlock 3145728
oracle        hard    memlock 3145728

Disable SELINUX

Depending on system edit:

  • /etc/selinux/config OR
  • /etc/sysconfig/selinux
SELINUX=disabled

The modification of the /etc/selinux/config file takes effect after a reboot.

Confirm SELinux Status

/usr/sbin/getenforce
Disabled

You can also use the sestatus command to show the status.

Install Dependencies\Packages

Oracle 19c Packages for Oracle Linux 8. The oracle-database-preinstall-19c rpm installs these automactically:

bc
binutils
elfutils-libelf
elfutils-libelf-devel
fontconfig-devel
glibc
glibc-devel
ksh
libaio
libaio-devel
libXrender
libX11
libXau
libXi
libXtst
libgcc
libnsl
librdmacm
libstdc++
libstdc++-devel
libxcb
libibverbs
make
policycoreutils
policycoreutils-python-utils
smartmontools
sysstat 

Oracle 12-19c Linux 7 List

yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

yum install libXmu -y
yum install libXxf86dga -y
yum install nfs-utils -y
yum install libXau -y
yum install libdmx -y
yum install xorg-x11-utils -y
yum install xorg-x11-xauth -y
yum install libXv -y
yum install libXi -y
yum install libXt -y
yum install libXxf86misc -y
yum install LibXxf86vm -y

yum install device-mapper-multipath -y
  • When using yum if a package is already installed it will display Nothing to do.
  • If you wish to check if a package exists you can use this: rpm -qa |grep -i <package name>
  • If you dont have access to the repositories you can do this check this way: rpm -ivh <package name>

If running RHEL 7 and Oracle 12.1.02 you will need enable the optional rpms and get this required package: compat-libstdc++-33:

yum-config-manager --enable rhel-7-server-optional-rpms
yum install compat-libstdc++-33 -y

This is said to have been fixed in 12.2.

Edit nproc: /etc/security/limits.d/90-nproc.conf

# Change this
* soft nproc 1024

# To this
* - nproc 16384

APPENDIX

Common BASH Aliases (place in .bashrc)

# Aliases - Common
alias cl='crontab -l'
alias l9='ls -alt | head -9'
alias l20='ls -alt | head -20'
alias l50='ls -alt | head -50'
alias tf='date;ls -l|wc -l'
alias oslog='tail -f /var/log/messages'

<- Install