Shell Oralce RAC集群环境部署脚本

[root@www ~]# cat env.sh 
#!/bin/bash
grid_pwd="grid"
oracle_pwd="oracle"


rac1='$rac1'
rac1_vip='$rac1-vip'
rac1_priv='$rac1_priv'

rac2='$rac2'
rac2_vip='$rac2-vip'
rac2_priv='$rac2-priv'
scan='$scan'

cat >>/etc/hosts <<EOF
192.168.179.99       $rac1
192.168.179.100      $rac1_vip
10.10.10.1           $rac1_priv

192.168.179.101      $rac2
192.168.179.102      $rac2_vip
10.10.10.2           $rac2_priv

192.168.179.103      $scan    
EOF

need_packages="binutils compat-libstdc++-33 compat-libstdc++-296 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++"

echo -e "\033[32m***********************************************************\033[0m"
echo -e "\033[32m                        System environment check             \033[0m"
missing_packages=`rpm -q $need_packages | grep "not installed"`

if [ -z "$missing_packages" ];then
	echo -e "\033[32mPackages check passed.\033[0m"
else
	echo -e "\033[32m${missing_packages} Please insert the os or Disc dvd to downloader the packages.\033[0m"
        echo -e "\033[32mWhere is your operation system installation media?\033[0m"
       
fi


read -p "please input  your choice dvd or iso:" input
case $input in
dvd) 
	mkdir -p /mnt/dvd
	mount /dev/cdrom /mnt/dvd
	;;
iso)    
	mkdir -p /mnt/dvd
        read -p "Where is the iso?(in absolute path,e.g., /u01/rhel-server-6/7.x-x86_64-dvd.iso)" iopath
        mount $iopath -o loop /mnt/dvd
        test $? -ne 0 && echo -e  "\033[32mError occured while mounting the media,exit!! please check and try again!\033[0m" &&exit
        ;;
*)
        echo -e "\033[32mplease input dvd or iso,please try again exit!!\033[0m"
        exit
        ;;
esac    

cat > /etc/yum.repos.d/rhel6.repo<<EOF
[local]
name=redhat-local
baseurl=file:///mnt/cdrom
gpgcheck=0
EOF

yum install $need_packages -y


groupadd -g 600 oinstall
groupadd -g 601 asmadmin
groupadd -g 602 asmdba
groupadd -g 603 asmoper
useradd -u 600 -g oinstall -G asmadmin,asmdba,asmoper grid
id grid
echo $grid_pwd | passwd grid --stdin
 
groupadd -g 604 dba
groupadd -g 605 oper
useradd -u 601 -g oinstall -G dba,oper,asmdba oracle
id oracle
echo $oracle_pwd | passwd oracle --stdin

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值