oracle11g_x64_rhel_preinstall

本文介绍了一种在Linux环境下为Oracle数据库软件准备系统环境的方法。主要内容包括安装必要的依赖软件包、创建所需的用户组及用户、设置资源限制等步骤。适用于希望自行部署Oracle数据库环境的技术人员。
#############################################
#!/bin/bash
#############################################

#To check whether the depended packages ware installed
echo "-----------------------------------------------"
echo -e "To check \e[31;7msoftware's dependency\e[0m"
echo "-----------------------------------------------"
echo ""

PACKAGE="binutils
compat-libstdc++
elfutils-libelf
elfutils-libelf-devel
elfutils-libelf-devel-static
gcc
gcc-c++
glibc
glibc-common
glibc-devel
glibc-headers
kernel-headers
ksh
libaio
libaio-devel
libgcc
libgomp
libstdc++
libstdc++-devel
make
sysstat"

for i in $PACKAGE
do
    if [ "$i" = "glibc-devel" ];then
        yum -y install $i >/dev/null 2>&1
    fi

    STAT=$(rpm -qa |grep -w $i)
    if [ "$STAT" != "" ];then
        echo -e "$i is \e[32;5minstalled\e[0m"
        echo ""
    else
        echo -e "$i is \e[31;5mnot\e[0m \e[32;5minstalled\e[0m"
        echo -e "\e[31;5minstalling\e[0m \e[32;5m$i\e[0m"
        yum -y install $i
        echo -e "$i is \e[32;5minstalled\e[0m"
    fi
done

echo "***********************************************"

sleep 1
clear



echo ""
echo "-----------------------------------------------"
echo -e "To \e[31;7mcheck again\e[0m"
echo "-----------------------------------------------"
echo ""
#To check again
for i in $PACKAGE
do
    STAT=$(rpm -q $i)
    if [ "$STAT" != "" ];then
        echo -e "\e[35;1m$i\e[0m is \e[32;4minstalled\e[0m"
    fi
done
echo ""
echo "***********************************************"

sleep 3
clear
#To install unixODBC
echo "-----------------------------------------------"
echo -e "To check \e[35;7munixODBC\e[0m"
echo "-----------------------------------------------"
echo ""
ODBC="unixODBC unixODBC-devel"
for i in $ODBC
do
if [ "$(rpm -qa|grep -w $i)" = "" ];then
    yum -y install unixODBC unixODBC-devel
    echo ""
    echo "Installed $i"
else
    echo -e "\e[35;1m$i\e[0m is \e[32;4minstalled\e[0m"
fi
done
echo "***********************************************"
sleep 1

#To prepare groups
echo ""
echo ""
echo ""
echo "-----------------------------------------------"
echo -e "To check \e[31;7mgroups\e[0m '\e[32;7moinstall, dba, oper, asmadmin, asmdba, asmoper\e[0m'"
echo "-----------------------------------------------"
echo ""
if [ "$(grep -w oinstall /etc/group)" = "" ];then
    /usr/sbin/groupadd oinstall
    echo -e "add group--->\e[31;1moinstall\e[0m"
else
    echo -e "\e[31;1moinstall\e[0m is exist"
fi

if [ "$(grep -w dba /etc/group)" = "" ];then
    /usr/sbin/groupadd -g 502 dba
    echo -e "add group--->\e[31;1mdba\e[0m"
else
    echo -e "\e[31;1mdba\e[0m is exist"
fi

if [ "$(grep -w oper /etc/group)" = "" ];then
    /usr/sbin/groupadd -g 503 oper
    echo -e "add group--->\e[31;1moper\e[0m"
else
    echo -e "\e[31;1moper\e[0m is exist"
fi

if [ "$(grep -w asmadmin /etc/group)" = "" ];then
    /usr/sbin/groupadd -g 504 asmadmin
    echo -e "add group--->\e[31;1masmadmin\e[0m"
else
    echo -e "\e[31;1masmadmin\e[0m is exist"
fi

if [ "$(grep -w asmoper /etc/group)" = "" ];then
    /usr/sbin/groupadd -g 505 asmoper
    echo -e "add group--->\e[31;1masmoper\e[0m"
else
    echo -e "\e[31;1masmoper\e[0m is exist"
fi

if [ "$(grep -w asmdba /etc/group)" = "" ];then
    /usr/sbin/groupadd -g 506 asmdba
    echo -e "add group--->\e[31;1masmdba\e[0m"
else
    echo -e "\e[31;1masmdba\e[0m is exist"
fi

echo "***********************************************"

#To add users
echo ""
echo ""
echo ""
echo "-----------------------------------------------"
echo -e "To check \e[31;7musers\e[0m '\e[32;7moracle, grid\e[0m'"
echo "-----------------------------------------------"
echo ""
if [ "$(grep -w oracle /etc/passwd)" = "" ];then
    /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba,oper oracle
    echo oracle|passwd --stdin oracle
    
    echo -e "add user--->\e[31;1moracle\e[0m"
else
    echo -e "\e[31;1moracle\e[0m is exist"
fi

if [ "$(grep -w grid /etc/passwd)" = "" ];then
    /usr/sbin/useradd -u 503 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
    echo oracle|passwd --stdin grid
    
    echo -e "add user--->\e[31;1mgrid\e[0m"
else
    echo -e "\e[31;1mgrid\e[0m is exist"
fi

echo "***********************************************"

#To check resource limits
echo ""
echo ""
echo ""
echo "-----------------------------------------------"
echo -e "To check \e[31;7mlimits\e[0m"
echo "-----------------------------------------------"
echo ""
if [ "$(grep -w oracle /etc/security/limits.conf)" = "" ];then
    echo "
    #For oracle
    oracle            soft    nproc   2047
    oracle            hard    nproc   16384
    oracle            soft    nofile  1024
    oracle          

转载于:https://www.cnblogs.com/lixuebin/archive/2013/06/04/10814631.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值