当前位置: 主页 > 操作系统 > Linux > linux下实现自动安装Oracle

linux下实现自动安装Oracle

时间:2009-12-22来源:互联网 点击:
本文介绍的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

站长资讯网
.
分页: [1] [2] [3]
TAG: Linux oracle 自动安装
推荐内容最近更新人气排行
关于我们 | 友情链接 | 网址推荐 | 常用资讯 | 网站地图 | RSS | 留言