oracledba.help works great on your mobile device too!

oracledba.help

Linux System Prep for Oracle

<- Install

TOC

Overview

What follows are all the common steps to prep a Linux 7.x system (RHEL, CentOS, Oracle Linux) to use Oracle 12c Grid Infrastructure or Database. I wrote this script to automate all this.

Oracle's Preinstallation rpm is useful to ensure things dont fall through cracks but is not complete. It can't hurt to run it after you are done.

Prerequisites

  • You have downloaded required install files:
    • Oracle Database 12c Database for Linux x86-64.
    • Oracle Database 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        (75 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

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

 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.

Create Directories

# Set User Variables
optGridEnv=0
APP_DEST_DIR="/u01/app"
RDBS_VERSION="12.2.0.1"; # 12.1.0.2
GRID_VERSION="12.2.0.1"; # 12.1.0.2

# Software
mkdir -p /u01/orasw/rpm
chown -R oracle:oinstall /u01/orasw

# Base Dirs
mkdir -p $APP_DEST_DIR
mkdir -p $APP_DEST_DIR/grid
mkdir -p $APP_DEST_DIR/oracle
mkdir -p $APP_DEST_DIR/cfgtoollogs
mkdir -p $APP_DEST_DIR/oraInventory

chown oracle:oinstall $APP_DEST_DIR
chown oracle:oinstall $APP_DEST_DIR/cfgtoollogs
chown oracle:oinstall $APP_DEST_DIR/oracle
chown grid:oinstall $APP_DEST_DIR/grid
chown grid:oinstall $APP_DEST_DIR/oraInventory

if [ $optGridEnv -eq 0 ]; then
   chown oracle:oinstall $APP_DEST_DIR/oraInventory
fi

# RDBMS HOME
mkdir -p $APP_DEST_DIR/oracle/product/$RDBS_VERSION/dbhome_1
chown -R oracle:oinstall $APP_DEST_DIR/oracle/product
chown -R oracle:oinstall $APP_DEST_DIR/oracle/product/$RDBS_VERSION
chown -R oracle:oinstall $APP_DEST_DIR/oracle/product/$RDBS_VERSION/dbhome_1

# GI HOME
mkdir -p /u01/app/$GRID_VERSION/grid
chown -R grid:oinstall $APP_DEST_DIR/$GRID_VERSION
chown -R grid:oinstall $APP_DEST_DIR/$GRID_VERSION/grid

chmod -R 775 /u01/

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

Stop Firewall

systemctl disable firewalld
systemctl stop 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.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
vm.swappiness = 1
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
kernel.panic_on_oops = 1
# HUGEPAGES SETTING FOR ORACLE
vm.nr_hugepages = 39953

Apply changes: /sbin/sysctl -p

If RAC System - Disable Reverse Path Filtering

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

Change eth0 and eth1 with your private interface names.

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

Install Dependencies\Packages

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

Cluster Verification Script

Note: Most all recent patches have the .rpm to install CVU.

  • Download.
  • Usage: runcluvfy.sh stage -pre crsinst -n <node1,node2> -fixup -verbose
    Example: /u01/orasw/grid/runcluvfy.sh stage -pre crsinst -n rac01,rac02 -fixup -verbose

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'

Useful rpms To Install]]

rlwrap, flash-player, sshpass:

cd /u01/orasw/rpm
rpm -ivh rlwrap-0.42-1.fc22.x86_64.rpm
rpm -ivh flash-player-npapi-24.0.0.186-release.x86_64.rpm
rpm -ivh sshpass-1.06-2.fc26.x86_64.rpm

<- Install