码迷,mamicode.com
首页 > 数据库 > 详细

写的一个oracle安装前的准备的脚本,大家可以拿去修改修改使用

时间:2015-02-15 13:44:41      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:oracle   安装脚本   

#!/bin/bash

# echo "拷贝文件:"
# read -p "please input the server you share your os installation media and oracle software:" server
# mkdir /installyationMedia
# scp root@${server}:/iso/* /installationMedia
# if [ -e /installationMedia/*.iso ]{
#  echo "文件拷贝成功。"
# }else{
#  echo "操作系统文件拷贝不成功"
# }

echo "**********************Mount the iso******************************"
mount -o loop /tmp/rhel-server-6.0-x86_64-dvd.iso /media
cat >/etc/yum.repos.d/cd.repo<<EOF
[cd]
name=cd.repo
baseurl=file:///media/Server
enabled=1
gpgcheck=0
EOF
yum clean
yum update
if [[ $? -eq 0 ]]; then
 echo "Yum repo configure success!"
 else
 echo "Yum repo configure failure!"
fi

echo "**********************Verify the dependency packages**************************"
for i in `cat package.txt`; do
 rpm -qa | grep ${i}
  if [[ $? -eq 0 ]]; then
   echo "${i} have been installed !" | tee -a log.txt
  else
   yum -y install ${i}*
   if [[ $? -eq 0 ]]; then
    echo "${i} Install Success;" | tee -a log.txt
   else
    echo "${i} install failure" | tee -a log.txt
   fi
  fi
done

echo "**********************unzip the packages*****************************"
if [[ -d /installationMedias/database ]]; then
 echo "Database Installation File have been created!"
else
 for i in `ls -l /installationMedias/linux*.zip | awk ‘{print $9}‘`; do
  unzip ${i} -d /installationMedias
 done
fi


echo "************************Environment Prepare*******************************"
if [[ -d /u01/app ]]; then
 echo "/u01/app Directory Have Been Created!"
else
 mkdir -p /u01/app
fi

if [[ -z `cat /etc/group | grep dba` ]]; then
 groupadd dba
else
 echo "dba group have been created" | tee log.txt
fi
if [[ -z `cat /etc/group | grep oinstall` ]]; then
 groupadd oinstall
else
 echo "dba group have been created" | tee log.txt
fi
if [[ -z `id oracle` ]]; then
 useradd -g oinstall -G dba oracle
else
 echo "user oracle have been created" | tee log.txt
fi
chown -R oracle:oinstall /u01
chmod -R 755 /u01

echo "**************************kernel parameter**********************************"
cat >>/etc/sysctl.conf<<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586
EOF
/sbin/sysctl -p
echo "change User limts"
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     pam_limits.so
EOF
cat >>/etc/profile<<EOF
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi
EOF
cat >>/home/oracle/.bash_profile<<EOF
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
EOF

su - oracle<<EOF
source ~/.bash_profile
/installationMedias/database/runInstaller
EOF

写的一个oracle安装前的准备的脚本,大家可以拿去修改修改使用

标签:oracle   安装脚本   

原文地址:http://ironkui.blog.51cto.com/6419870/1614504

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!