shell脚本实现linux下自动安装Oracle10g
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-04-28
本文介绍的shell脚本是我初学shell脚本编程时为了练习shell编程,也为了方便oracle初装写的.大家都知道Oracle在linux下的安装是很繁琐
的,容易出错,也比较耗时.对于初学Oracle的新手来说,可能会遇到经常重装ORACLE的情况,如果把精力过多的用于安装,感觉会有点得不偿
失. 本脚本所做的事情并不是完全的安装好ORCLE,那也是不可能的事情,ORACLE安装的后期是有图形界面的交互模式,本脚本所做的只是前期环境配置,但就是这些前期配置才是最耗时的,写成脚本很必要. 本脚本只在RHEL5U3上做过测试,可以正常使用,对于其他版本有待验证和完善. #!/bin/bash #This program is used for helping you install oracle10g automatically. #Be used in Redhat 5 enterprise. #Statment:Before installing oracle10g by this program,you should prepare oracle10g tar.gz file, rlwrap and redhat install CD path.If you have any question about this program,you could contact me by the following email address. #Author:Levin Wong<findingcc@126.com> #Written on xxxx trap ''echo;exit 0;'' 2 #Set trap,so you can interrupt the program when it is running. shmmax=$(($(free |awk ''NR==2{print $2}'')*1024/2)) #Set the argument "shmmax" according to the memory size of your computer. read -p "Please input the oracle username that you want to create:" ooname read -p "Please verify the oracle username:" oname until [ ! -z "$oname" ] #Make judgment about if the variable $oname you given is null. do read -p "Please verify the oracle username:" oname done username=$(awk -F: ''{print $1}'' /etc/passwd) for i in $username #Judge about if $oname already exists in your system. do if [ $oname = $i ] then echo "Error!The username you input is already exists in your system."; exit 1 fi done until [ ${oname}x = ${ooname}x ] #Make sure that the input is the very one which you want. do read -p "Please input the oracle username that you want to create:" ooname read -p "Please verify the oracle username:" oname if [ -z "$oname" ] #If $oname is still null,then exit this program. then echo "Error!" exit 1 fi done read -p "Please input rlwrap path:" rlpath read -p "Please input the path of CD:" cdpath until [ -e "$cdpath"/Server ] #Make sure the path that you given is right. do read -p "Wrong path of CD,please retry:" cdpath done read -p "Please input your oracle tar.gz package name(include path) :" opackage if [ ! -f "$opackage" ] then echo "The package is wrong!" exit 1 fi { groupadd oinstall groupadd dba useradd -m -g oinstall -G dba $oname mkdir -p /u01/app/$oname chown -R $oname:oinstall /u01/app/$oname chmod -R 775 /u01/app/$oname }&>/dev/null tar -zxf $opackage -C /home/$oname &>/dev/null until [ "$?" -eq "0" ] #Make sure that the package you given is absolutely right. do read -p "Wrong package,please retry:" opachage tar -zxf $opackage -C /home/$oname &>/dev/null done pushd $cdpath/Server &>/dev/null { rpm -Uvh compat-db-4* rpm -Uvh libaio-0* rpm -Uvh co |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于shell脚本实现linux下自动安装Oracle10g的所有评论