Grid Infrastructure & Oracle Database 12c – Preinstallation tasks

To install Oracle Grid Infrastructure & Oracle Database on Oracle Linux 7, you need to prepare your OS. To do so, you have to follow these commands:

First of all, you have to install required packages in the OS:


yum install -y cloog-ppl libXxf86misc
yum install -y compat-libcap1 libXxf86vm
yum install -y compat-libstdc++-33 libaio-devel
yum install -y cpp libdmx
yum install -y gcc libstdc++-devel
yum install -y gcc-c++ mpfr
yum install -y glibc-devel make
yum install -y glibc-headers ppl
yum install -y kernel-headers xorg-x11-utils
yum install -y libXmu xorg-x11-xauth
yum install -y libXt libXv
yum install -y ksh libXxf86dga
yum install -y elfutils-libelf-devel
yum install -y sysstat
yum install -y smartmontools
yum install -y nfs-utils
yum install -y unzip
yum install -y net-tools
yum install -y kmod-oracleasm 
yum install -y oracleasm-support

then, you have to edit /etc/hosts file and add the appropariate record as bellow:


echo "IP hostname hostname.domain" > /etc/hosts

you may change IP, hostname and domain based on your enviroment.

after that, you should calculate 3 parameters like this:

  • SHMALL = TOTAL RAM IN BYTES / PAGE_SIZE
  • SHMMAX = HALF OF TOTAL RAM IN BYTES
  • SHMMNI = PAGE_SIZE

to determine RAM size in bytes, you can use free command:


free -b

then you will edit /etc/sysctl.conf file and add these lines:


vi /etc/sysctl.conf

vm.swappiness = 0
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
kernel.shmmax = <strong>SHMMAX </strong>
kernel.shmall = <strong>SHMALL </strong>
kernel.shmmni = <strong>SHMMNI </strong>
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
fs.aio-max-nr = 1048576
fs.file-max = 6815744

and use this command to apply these changes:


sysctl -p

then, you should add users and groups in OS:


groupadd oinstall
groupadd dba
groupadd asmdba
groupadd asmoper
groupadd asmadmin
groupadd oper
useradd -g oinstall -G dba,oper,asmdba,asmoper oracle
useradd -g oinstall -G dba,asmadmin,asmdba,asmoper grid

if oracle or grid users exist, we can use these command instead of useradd:


usermod -g oinstall -G dba,oper,asmdba,asmoper oracle
usermod -g oinstall -G dba,asmadmin,asmdba,asmoper grid

after that, you have to change password of these users:


passwd oracle
passwd grid

then, you should make directories for database and grid app and set permissions:


mkdir /u01
chown -R oracle:oinstall /u01 
mkdir /u01/crs
mkdir /u01/crs/grid
chown -R grid:oinstall /u01/crs 
mkdir /u01/app
chown -R oracle:oinstall /u01/app

if you downloaded sources from oracle web site, you can upload V840012-01.zip and V839960-01.zip to a directory (example: /source) and then extract then in their destinations:


unzip /source/V840012-01.zip -d /u01/crs/grid
unzip /source/V839960-01.zip -d /home/oracle

then, you have to install an rpm file:


rpm -ivh /u01/crs/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm

and edit /etc/security/limits.d/99-grid-oracle-limits.conf file and add records as below:


vi /etc/security/limits.d/99-grid-oracle-limits.conf

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

to apply these changes, you have to use this command:


ulimit -a 

the next step is oracleasm configuration:


/usr/sbin/oracleasm configure -i
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [grid]: <strong>grid</strong>
Default group to own the driver interface [asmadmin]: <strong>asmadmin</strong>
Start Oracle ASM library driver on boot (y/n) [y]: <strong>y</strong>
Scan for Oracle ASM disks on boot (y/n) [y]: <strong>y</strong>
Writing Oracle ASM library driver configuration: done

now, you have to start oracleasm service and make it available on startup:


systemctl enable oracleasm.service
systemctl start oracleasm.service

to make asm disks from raw devices (example: /dev/sdb*) you have to use this command:


/usr/sbin/oracleasm createdisk DATA101 /dev/sdb1
/usr/sbin/oracleasm createdisk DATA102 /dev/sdb2
/usr/sbin/oracleasm createdisk DATA103 /dev/sdb3

then you run these commands:


/usr/sbin/oracleasm scandisks
/usr/sbin/oracleasm listdisks

and you have to config .bash_profile file of grid user:


vi /home/grid/.bash_profile

and insert these records in it:


# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
export ORACLE_BASE=/u01/crs/oracle
export ORACLE_HOME=/u01/crs/grid
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_DOC=$ORACLE_HOME/doc
export NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256
export TMPDIR=/tmp
export TMP=/tmp.
export TZ=Asia/Tehran
export ORACLE_SID=+ASM
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/gg
export ORACLE_UNQNAME=dbtest12
export ORACLE_HOSTNAME=S1VLDbCOraT01.enb.local
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin/OPatch:$ORACLE_HOME/bin:/usr/bin/X11:/usr/local/bin:/usr/sbin::/sbin:.
export OWB_HOME=$ORACLE_HOME
unset USERNAME
echo ".profile has been DONE successfully"

finally, you should go to grid software location and start oracle universal installer:


cd /u01/crs/grid
./gridSetup.sh