CentOS安装oracle10g配置脚本

CentOS上安装oracle前的配置脚本。

没有技术含量只是为了,省些时间。

 

#!/bin/bash
#CentOS  RedHat
echo "======= hello! now config  oracle database ========="
#--------------------
echo "1 : check system "
# memory
mem=$(free -m |head -2|tail -1|cut -c6-18)
echo -n "memory total:$mem "
if [ $mem -ge 1000 ];then
  echo ":<OK>"
else
  echo ":need more than 1024M <faild>"
  exit 1
fi
# swap
swap=$(free -m |tail -1|cut -c6-18)
echo -n "Swap total:$swap "
if [ $swap -ge 1500 ];then
  echo ":<OK>"
else
  echo ":need more than 1500M <faild>"
  exit 1
fi
# diskfree
df_free=$(df -m / |tail -1| cut -c41-50)
echo -n "disk free:$df_free "
if [ $df_free -gt 2048 ];then
  echo ":<OK>"
else
  echo ":need more than 2048M <faild>"
  exit 1
fi
# OS release
if [ ! -f /etc/redhat-release.bak ];then
  cp /etc/redhat-release /etc/redhat-release.bak
  echo "Red Hat Enterprise Linux Server release 4" > /etc/redhat-release
fi
os=$(cat /etc/redhat-release.bak|cut -c0-7)
case $os in
  "CentOS ")
   os_path='/media/cdrom/CentOS/RPMS' ;;
  "Red Hat")
   os_path='/media/cdrom/Server' ;;
esac
os=$(cat /etc/redhat-release)
echo "OS : $os: <OK>"
#------------------
echo
echo "2 : check libs form cdrom "
cd_flag=$(ls /media/cdrom|wc -l)
#echo $cd_flag #-debug
if [ $cd_flag -lt 1 ];then
  mount /dev/hdc /media/cdrom
  if [ $? -ne 0 ];then
    echo "please insert CD "
    exit 1
  fi
fi
#echo "$os_path" #--debug
cd $os_path
rpm -Uvh binutils*
rpm -Uvh compat-db*
rpm -Uvh gcc-3.4*
rpm -Uvh gcc-c++*
rpm -Uvh glibc-2.3*
rpm -Uvh glibc-common*
rpm -Uvh libstdc++-3.4*
rpm -Uvh libstdc++-devel*
rpm -Uvh libaio*
rpm -Uvh make*
rpm -Uvh pdksh*
rpm -Uvh sysstat*
rpm -Uvh xscreensaver*
#rpm -Uvh
umount /media/cdrom
#-----------------
echo
echo "3 : add user "
if [ ! -d /opt/oracle ];then
  mkdir /opt/oracle
fi
id oracle > /dev/null 2>&1
if [ $? -ne 0 ];then
  useradd oracle
  echo "|----------------------------------------------|"
  echo "|---- please  input your passwd -------|"
  echo "|----------------------------------------------|"
  passwd oracle
fi
chmod -R 775 /opt/oracle
chown oracle.oracle /opt/oracle
if [ $? -eq 0 ];then
  echo 'user:(oracle) add. directory:(/opt/oracle/) has make'
fi
#-----------------
echo
echo "4 : config kernel params "
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmin = 4096
kernel.sem = 25032000100128
fs.file-max = 65535
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF
/sbin/sysctl -p

cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <<EOF
session   required  /lib/security/pam_limits.so
EOF

cat >> /etc/profile <<EOF
if [ /$USER = "oracle" ];then
  if [ /$SHELL = "/bin/ksh" ];then
    ulimit -p 16384
    ulimit -p 65536
  else
    ulimit -p 16384 -n 65536
  fi
  umask 022
fi
EOF
cat >> /etc/csh.login <<EOF
if ( /$USER == "oracle") then
  limit maxproc 16384
  limit descriptors 65536
  umask 022
endif
EOF

cat >>  /home/oracle/.bashrc << EOF
ORACLE_BASE=/opt/oracle
export ORACLE_BASE
ORACLE_HOME=/$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_HOME
ORACLE_SID=ORCL
export ORACLE_SID
PATH=/usr/sbin:/$PATH
PATH=/$ORACLE_HOME/bin:/$PATH
LD_LIBRARY_PATH=/${LD_LIBRARY_PATH}:/$ORACLE_HOME/lib:/lib:/usr/lib
export LD_LIBRARY_PATH
CLASS_PATH=/$ORACLE_HOME/JRE:/$ORACLE_HOME/jlib:/$ORACLE_HOME/rdbms/jilib
export CLASS_PATH
LANG=en_US.utf8
export LANG
EOF

#source /home/oracle/.bash_profile

echo
echo "params OK"
echo "============= END ==============="

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值