Home > Database > Mysql Tutorial > body text

Linux 安装Oracle的shell脚本

WBOY
Release: 2016-06-07 16:58:34
Original
1014 people have browsed it

在Linux平台下面安装Oracle,要做好多的准备工作。比如建立user,修改环境变量,一些oracle所需的参数。现在整理成shell脚本,以

在Linux平台下面安装Oracle,要做好多的准备工作。比如建立user,,修改环境变量,一些oracle所需的参数。现在整理成shell脚本,以方便安装。
一、创建安装脚本
vi install.sh
#/bin/bash
. ./adduser.sh
. ./sysctl.sh
. ./limits.sh
. ./mkdir.sh
. ./chprofile.sh

二、添加用户及用户组
vi adduser.sh

#/bin/bash
ADDGROUPS="oinstall dba"
ADDUSERS="oracle"

for group in $ADDGROUPS ; do

       if [ -z "$( awk -F: '{print $1}' /etc/group |grep $group)" ]; then
                groupadd $group
                echo " Add new group $group"
       else
                echo " Group $group already existed"
       fi
done

for user in $ADDUSERS ; do

       if [ -z "$( awk -F: '{print $1}' /etc/passwd |grep $user)" ]; then
                useradd $user
                echo " Add new user $user"
       else
                echo " User $user already existed"
       fi
done

if $(usermod -g oinstall -G dba oracle) ;   then
echo " Modify user oracle account success"
else
echo " Modify user oracle account failure"
fi

三、创建所需的目录
vi mkdir.sh

#/bin/bash
ORACLE_FILE_BASE="/u01/app/oracle"
ORACLE_FILE_VAR="/var/opt/oracle"
ORACLE_FILE_HOME="$ORACLE_FILE_BASE/product/10.2.0/db_1"

for directory in $ORACLE_FILE_BASE $ORACLE_FILE_VAR $ORACLE_FILE_HOME ; do
       if [ -d $directory ]; then
            echo " Directory $directory   already existed"
       else
            mkdir -p $directory
            chown -R oracle.dba $directory
            echo " Change directory $directory owner and group success"
       fi
done

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!