Créé le 14/08/2015 par Laurent Bourcier
Script de vérification des pre requis Oracle sur RedHat 7
#
# Verification des prerequis Oracle 12cR1 sur Linux RedHat EL 7
#
ORACLE_OWNER=oracle
DBA_GROUP=dba
OINSTALL_GROUP=oinstall
ORACLE_BASE=/app/${ORACLE_OWNER}
ORACLE_HOME=/app/${ORACLE_OWNER}/product/12.1.0/db12102
FS_INSTALL=/
HOST=`hostname`
LOGFILE="./log/check_db_12cR1_system_requirements_rhel7_${HOST}_`date '+%Y%m%d_%H%M%S'`.log"
exec > $LOGFILE
echo "--------------------------------------------------------------------------------"
echo "Verification des prerequis systeme pour Oracle 12cR1 sur RHEL7"
echo "--------------------------------------------------------------------------------"
echo "hostname :"
echo " ................................... $HOST"
echo "Compte et groupes :"
echo " ORACLE_OWNER ...................... $ORACLE_OWNER"
echo " DBA_GROUP ......................... $DBA_GROUP"
echo " OINSTALL_GROUP .................... $OINSTALL_GROUP"
echo "Repertoires :"
echo " ORACLE_BASE ....................... $ORACLE_BASE"
echo " ORACLE_HOME ....................... $ORACLE_HOME"
echo "File Systems :"
echo " FS_INSTALL ........................ $FS_INSTALL"
echo ""
# ==================================================================
# 0. Check OS release
# ==================================================================
echo "Check OS release"
printf " Red Hat Enterprise Linux 7.x ............... "
VALUE=`grep "Red Hat" /etc/issue`
grep "Red Hat Enterprise Linux Server release 7" /etc/issue > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "OK ( $VALUE )"
else
echo "ERROR ( $VALUE )"
fi
# ==================================================================
# 1. Hardware
# ==================================================================
echo "Check Hardware"
printf " Memory (at least 1 GB) ..................... "
MEMORY_MB=`grep MemTotal /proc/meminfo | awk '{ print $2 }'`
MEMORY_MB=`expr $MEMORY_MB / 1024`
if [ $MEMORY_MB -ge 1024 ]
then
echo "OK ($MEMORY_MB MB)"
else
echo "ERROR"
fi
printf " Swap (at least 1 GB) ....................... "
SWAP_MB=`grep SwapTotal /proc/meminfo | awk '{ print $2 }'`
SWAP_MB=`expr $SWAP_MB / 1024`
if [ $SWAP_MB -ge 1024 ]
then
echo "OK ($SWAP_MB MB)"
else
echo "ERROR"
fi
printf " Architecure (x86_64) ....................... "
uname -m | grep x86_64 > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo OK
else
echo ERROR
fi
printf " Disk space (6.5 GB free on FS) ............. "
DISK_FREE_MB=`df -mP $FS_INSTALL | tail -1 | awk '{ print $4 }'`
if [ $DISK_FREE_MB -ge 6656 ]
then
echo "OK ($DISK_FREE_MB MB free) on $FS_INSTALL"
else
echo "ERROR ($DISK_FREE_MB MB free) on $FS_INSTALL"
fi
printf " Runlevel (3 minimum) ....................... "
RUNLEVEL=`/sbin/runlevel | awk '{ print $2 }'`
if [ $RUNLEVEL -ge 3 ]
then
echo "OK ($RUNLEVEL)"
else
echo "ERROR ($RUNLEVEL)"
fi
# ==================================================================
# 2. Software
# ==================================================================
echo "Check Software"
echo "openssh;1.0.0;x86_64
binutils;2.23.52.0.1;x86_64
compat-libcap1;1.10;x86_64
gcc;4.8.2;x86_64
gcc-c++;4.8.2;x86_64
glibc;2.17;i686
glibc;2.17;x86_64
glibc-devel;2.17;i686
glibc-devel;2.17;x86_64
ksh;1.0.0;x86_64
libaio;0.3.109;i686
libaio;0.3.109;x86_64
libaio-devel;0.3.109;i686
libaio-devel;0.3.109;x86_64
libgcc;4.8.2;i686
libgcc;4.8.2;x86_64
libstdc++;4.8.2;i686
libstdc++;4.8.2;x86_64
libstdc++-devel;4.8.2;i686
libstdc++-devel;4.8.2;x86_64
libXi;1.7.2;i686
libXi;1.7.2;x86_64
libXtst;1.2.2;i686
libXtst;1.2.2;x86_64
make;3.82;x86_64
sysstat;10.1.5;x86_64
compat-libstdc++-33;3.2.3;x86_64" | while read LINE
do
RPM_NAME=`echo $LINE | awk -F';' '{ print $1 }'`
RPM_VERS=`echo $LINE | awk -F';' '{ print $2 }'`
RPM_ARCH=`echo $LINE | awk -F';' '{ print $3 }'`
NAME_SIZE=${#RPM_NAME}
ARCH_SIZE=${#RPM_ARCH}
BLANK_SIZE=`expr 40 - $NAME_SIZE`
BLANK_SIZE=`expr $BLANK_SIZE - $ARCH_SIZE`
BLANK=`echo "............................................................." | cut -c1-${BLANK_SIZE}`
printf " ${RPM_NAME} ($RPM_ARCH) ${BLANK} "
#rpm -q --queryformat '%{ARCH} %{NAME} %{VERSION}\n' $RPM_NAME > /dev/null 2>&1
if [ "$RPM_ARCH" = "i386" -o "$RPM_ARCH" = "i686" ]
then
rpm -q --queryformat '%{ARCH} %{NAME}\n' $RPM_NAME | grep "i386 " > /dev/null 2>&1
R1=$?
rpm -q --queryformat '%{ARCH} %{NAME}\n' $RPM_NAME | grep "i686 " > /dev/null 2>&1
R2=$?
if [ $R1 -eq 0 -o $R2 -eq 0 ]
then
FOUND_VERSION=`rpm -q --queryformat "%{VERSION} %{ARCH}\n" $RPM_NAME | grep "i[36]86" | awk '{print $1}'`
echo "OK version ${FOUND_VERSION} (required ${RPM_VERS})"
else
echo "NOT FOUND"
fi
else
rpm -q --queryformat '%{ARCH} %{NAME}\n' $RPM_NAME | grep "$RPM_ARCH " > /dev/null 2>&1
if [ $? -eq 0 ]
then
FOUND_VERSION=`rpm -q --queryformat "%{VERSION} %{ARCH}\n" $RPM_NAME | grep x86_64 | awk '{print $1}'`
echo "OK version ${FOUND_VERSION} (required ${RPM_VERS})"
else
echo "NOT FOUND"
fi
fi
done
# ==================================================================
# 3. Kernel parameters
# ==================================================================
RAM_KB=`grep "MemTotal" /proc/meminfo | awk '{ print $2 }'`
RAM_BYTES=`expr $RAM_KB \* 1024`
PAGE_SIZE=`getconf PAGE_SIZE`
KERNEL_SHMALL_MIN=`expr $RAM_BYTES / $PAGE_SIZE`
KERNEL_SHMMAX_MIN=`expr $RAM_BYTES / 2`
KERNAL_SHMMAX_MAX=`expr $RAM_BYTES - 1`
echo "Check Kernel parameters"
echo " ---> /etc/sysctl.conf"
echo "fs.aio-max-nr;1048576;equal
fs.file-max;6815744;equal
kernel.shmall;$KERNEL_SHMALL_MIN;min
kernel.shmmax;$KERNEL_SHMMAX_MIN;min
kernel.shmmni;4096;equal
kernel.sem;250 32000 100 128;equal
kernel.panic_on_oops;1;equal
net.ipv4.ip_local_port_range;9000 65500;equal
net.core.rmem_default;262144;equal
net.core.rmem_max;4194304;equal
net.core.wmem_default;262144;equal
net.core.wmem_max;1048576;equal" | while read LINE
do
KERNEL_NAME=`echo $LINE | awk -F';' '{ print $1 }'`
KERNEL_VALUE=`echo $LINE | awk -F';' '{ print $2 }'`
FONC=`echo $LINE | awk -F';' '{ print $3 }'`
NAME_SIZE=${#KERNEL_NAME}
VALUE_SIZE=${#KERNEL_VALUE}
BLANK_SIZE=`expr 43 - $NAME_SIZE`
BLANK=`echo "............................................................." | cut -c1-${BLANK_SIZE}`
printf " ${KERNEL_NAME} ${BLANK} "
VALUE=`/sbin/sysctl -a 2>/dev/null | grep $KERNEL_NAME | awk '{print $3" "$4" "$5" "$6}' | sed "s/ [ ]*$//g"`
if [ "$FONC" = "equal" ]
then
if [ "$VALUE" = "$KERNEL_VALUE" ]
then
echo "OK FOUND $VALUE (required $FONC $KERNEL_VALUE)"
else
echo "ERROR FOUND $VALUE (required $FONC $KERNEL_VALUE)"
fi
fi
if [ "$FONC" = "min" ]
then
if [ $VALUE -ge $KERNEL_VALUE ]
then
echo "OK FOUND $VALUE (required $FONC $KERNEL_VALUE)"
else
echo "ERROR FOUND $VALUE (required $FONC $KERNEL_VALUE)"
fi
fi
done
# ==================================================================
# 4. Resolution hostname
# ==================================================================
echo "Resolution hostname"
echo " ---> /etc/hosts"
echo " hostname ............................................. "`hostname`
ping -c 1 `hostname` > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo " Ping hostname ........................................ OK"
else
echo " Ping hostname ........................................ ERROR"
fi
# ==================================================================
# 5. Configuration du compte proprietaire oracle
# ==================================================================
echo "Configuration du compte proprietaire oracle"
echo " ---> /etc/security/limits.conf"
echo " ORACLE_OWNER ............................... $ORACLE_OWNER"
printf " Présence du compte ORACLE_OWNER ............ "
ORACLE_UID=`grep "^$ORACLE_OWNER:" /etc/passwd | awk -F':' '{print $3}'`
if [ "$ORACLE_UID" != "" ]
then
echo "OK (uid = $ORACLE_UID)"
OWNER_OK=1
else
echo "Not FOund"
OWNER_OK=0
fi
printf " Présence du groupe DBA_GROUP ............... "
DBA_GID=`grep "^$DBA_GROUP:" /etc/group | awk -F':' '{print $3}'`
if [ $? -eq 0 ]
then
echo "OK (gid = $DBA_GID)"
else
echo "Not FOund"
fi
printf " Présence du groupe OINSTALL_GROUP .......... "
OINSTALL_GID=`grep "^$OINSTALL_GROUP:" /etc/group | awk -F':' '{print $3}'`
if [ $? -eq 0 ]
then
echo "OK (gid = $OINSTALL_GID)"
else
echo "Not FOund"
fi
printf " nofile Soft at least 1024 .................. "
if [ $OWNER_OK -eq 1 ]
then
if [ "$USER" = "$ORACLE_OWNER" ]
then
VALUE=`ulimit -Sn`
else
VALUE=`su $ORACLE_OWNER -c "ulimit -Sn"`
fi
if [ "$VALUE" = "unlimited" ]
then
echo "OK FOUND $VALUE"
else
if [ $VALUE -ge 1024 ]
then
echo "OK FOUND $VALUE"
else
echo "ERROR FOUND $VALUE"
fi
fi
else
echo "ERROR"
fi
printf " nofile Hard at least 65536 ................. "
if [ $OWNER_OK -eq 1 ]
then
if [ "$USER" = "$ORACLE_OWNER" ]
then
VALUE=`ulimit -Hn`
else
VALUE=`su $ORACLE_OWNER -c "ulimit -Hn"`
fi
if [ "$VALUE" = "unlimited" ]
then
echo "OK FOUND $VALUE"
else
if [ $VALUE -ge 65536 ]
then
echo "OK FOUND $VALUE"
else
echo "ERROR FOUND $VALUE"
fi
fi
else
echo "ERROR"
fi
printf " nproc Soft at least 2047 ................... "
if [ $OWNER_OK -eq 1 ]
then
if [ "$USER" = "$ORACLE_OWNER" ]
then
VALUE=`ulimit -Su`
else
VALUE=`su $ORACLE_OWNER -c "ulimit -Su"`
fi
if [ "$VALUE" = "unlimited" ]
then
echo "OK FOUND $VALUE"
else
if [ $VALUE -ge 2047 ]
then
echo "OK FOUND $VALUE"
else
echo "ERROR FOUND $VALUE"
fi
fi
else
echo "ERROR"
fi
printf " nproc Hard at least 16384 .................. "
if [ $OWNER_OK -eq 1 ]
then
if [ "$USER" = "$ORACLE_OWNER" ]
then
VALUE=`ulimit -Hu`
else
VALUE=`su $ORACLE_OWNER -c "ulimit -Hu"`
fi
if [ "$VALUE" = "unlimited" ]
then
echo "OK FOUND $VALUE"
else
if [ $VALUE -ge 16384 ]
then
echo "OK FOUND $VALUE"
else
echo "ERROR FOUND $VALUE"
fi
fi
else
echo "ERROR"
fi
printf " stack Soft at least 10240 .................. "
if [ $OWNER_OK -eq 1 ]
then
if [ "$USER" = "$ORACLE_OWNER" ]
then
VALUE=`ulimit -Ss`
else
VALUE=`su $ORACLE_OWNER -c "ulimit -Ss"`
fi
if [ "$VALUE" = "unlimited" ]
then
echo "OK FOUND $VALUE"
else
if [ $VALUE -ge 10240 ]
then
echo "OK FOUND $VALUE"
else
echo "ERROR FOUND $VALUE"
fi
fi
else
echo "ERROR"
fi
printf " stack Hard at least 10240 at most 32768 .... "
if [ $OWNER_OK -eq 1 ]
then
if [ "$USER" = "$ORACLE_OWNER" ]
then
VALUE=`ulimit -Hs`
else
VALUE=`su $ORACLE_OWNER -c "ulimit -Hs"`
fi
if [ "$VALUE" = "unlimited" ]
then
echo "ERROR FOUND $VALUE"
else
if [ $VALUE -ge 10240 -a $VALUE -le 32768 ]
then
echo "OK FOUND $VALUE"
else
echo "ERROR FOUND $VALUE"
fi
fi
else
echo "ERROR"
fi
# ==================================================================
# 7. SELinux
# ==================================================================
echo "SELinux"
echo " ---> /etc/selinux/config"
printf " getenforce ................................. "
VALUE=`/usr/sbin/getenforce`
if [ "$VALUE" = "Enforcing" ]
then
echo "ERROR FOUND $VALUE"
else
echo "OK FOUND $VALUE"
fi
# ==================================================================
# 99. Fin
# ==================================================================
echo "Fin"