ORACLE 11G 6.2 安装

6.2 安装 专栏收录该内容
1 篇文章 0 订阅

#!/bin/sh

########################################################################
#                  note
#the script is set parameters for set up oracle on redhat system.Iso image source,
#yum install rpm packages and you can vnc to install the Oracle database.
#version  1.0
#environment:
#1) sys   -  Red Hat Enterprise Linux Server release 6.3 (Santiago) x86_64 GNU/Linux
#2) oracle - linux.x64_11gR2_database
#3) run script: 1 chmod 777 setup_oracle11g_rh6.3_x64.sh    2 ./setup_oracle11g_rh6.3_x64.sh
########################################################################

#### set parameters config start!
#oracle setup dir
orasetdir=/u01/app;
dbsid=orcl;
packagefiles1='pdksh-5.2.14-37.el5_8.1.x86_64.rpm';
packserver=ServerSetOra;
sysbitstr="x86_64";
sysnamestr='Red Hat Enterprise Linux Server release 6';
#### set parameters config end!

## set
mypath=$PWD;
vardate=`date +%Y%m%d%H%M%S`;
i=0;


let i=$i+1;
printf "....................................................................$i \n";

printf "place wait installing package  .....  \n";
#### Check the environment start !
##check
if [ ! $USER = root  ];then
   printf  "Please rerun this script as root .";
   exit; 
fi

let i=$i+1;
printf "....................................................................$i \n";
##chck system
sysbit=/proc/version;
sysname=/etc/redhat-release;
 if (grep "$sysnamestr" $sysname) && (grep $sysbitstr $sysbit) ; then
   printf "chck system  ok ! \n  ";
   cat $sysname;
   cat $sysbit;
 else
   printf "chck system  error ! \n  ";
   cat $sysname;
   cat $sysbit;
   exit;
 fi

##Check yum(undo)

let i=$i+1;
printf "....................................................................$i \n";
##check package files
if  [ -f $mypath"/"$packserver"/"$packagefiles1 ];
 then
  printf "check package files ok ! \n  ";
 else
  printf "check package files error ! \n  ";
  exit;
fi
#### Check the environment end   !

let i=$i+1;
printf "....................................................................$i \n";
printf "place wait installing package  ....................  \n";
if true ; then
 #rpm
 rpm -ivh $mypath"/"$packserver"/"$packagefiles1
  #yum install pakage
 yum install binutils -y
 yum install compat-libstdc++-33 -y
 yum install compat-libstdc++-33.i686 -y
 yum install elfutils-libelf -y
 yum install elfutils-libelf-devel -y
 yum install gcc -y
 yum install gcc-c++ -y
 yum install glibc -y
 yum install glibc.i686 -y
 yum install glibc-common -y
 yum install glibc-devel -y
 yum install glibc-devel.i686 -y
 yum install glibc-headers -y
 yum install libaio -y
 yum install libaio.i686 -y
 yum install libaio-devel -y
 yum install libaio-devel.i686 -y
 yum install libgcc -y
 yum install libgcc.i686 -y
 yum install libstdc++ -y
 yum install libstdc++.i686 -y
 yum install libstdc++-devel -y
 yum install make -y
 yum install numactl-devel -y
 yum install sysstat -y
 yum install unixODBC -y
 yum install unixODBC.i686 -y
 yum install unixODBC-devel -y
 yum install unixODBC-devel.i686 -y
 yum install tigervnc-server -y
 yum groupinstall  'X Window System' -y
 yum groupinstall Desktop  -y
fi
### add oracle group
let i=$i+1;
printf "....................................................................$i \n";
printf "create oracle user and oracle group .....\n  ";
 /usr/sbin/groupadd oinstall
 /usr/sbin/groupadd -g 502 dba
 /usr/sbin/useradd -u 502 -g oinstall -G dba oracle
printf "plase change user oracle pass word.....\n";
 passwd oracle

### create oracle dir
let i=$i+1;
printf "....................................................................$i \n";
printf "create setup oracele directry   $orasetdir \n";
 mkdir -p $orasetdir
 chown -R oracle:oinstall $orasetdir
 chmod -R 775 $orasetdir

### edit files
let i=$i+1;
printf "....................................................................$i \n";
seclimit='/etc/security/limits.conf';
cp $seclimit $seclimit.$vardate;
 if grep "oracle"  $seclimit; then
   printf "the file aready set $seclimit   set next file  ....\n  ";
 else
  printf "edit file $seclimit  \n";
  echo "#the next rows install oracle add satrt !" >> $seclimit;
  echo "oracle   soft   nofile    131072" >> $seclimit;
  echo "oracle   hard   nofile    131072" >> $seclimit;
  echo "oracle   soft   nproc    131072" >> $seclimit;
  echo "oracle   hard   nproc    131072" >> $seclimit;
  echo "oracle   soft   core    unlimited" >> $seclimit;
  echo "oracle   hard   core    unlimited" >> $seclimit;
  echo "oracle   soft   memlock    50000000" >> $seclimit;
  echo "oracle   hard   memlock    50000000" >> $seclimit;
  echo "#the next rows install oracle add end! " >> $seclimit;
 fi

let i=$i+1;
printf "....................................................................$i \n";
sysconf='/etc/sysctl.conf';
cp $sysconf $sysconf.$vardate;
 if grep "kernel.sem"  $sysconf; then
   printf "the file aready set $sysconf   set next file  ....\n  ";
 else
  echo "#the next rows install oracle add" >> $sysconf;
   echo "fs.aio-max-nr = 3145728" >> $sysconf;
  echo "fs.file-max = 6815744" >> $sysconf;
  echo "kernel.shmmni = 4096" >> $sysconf;
  echo "kernel.sem = 250 32000 100 142" >> $sysconf;
  echo "net.ipv4.ip_local_port_range = 9000 65500" >> $sysconf;
  echo "net.core.rmem_default = 262144" >> $sysconf;
  echo "net.core.rmem_max = 4194304" >> $sysconf;
  echo "net.core.wmem_default = 262144" >> $sysconf;
  echo "net.core.wmem_max = 1048576" >> $sysconf;

  if grep "kernel.shmall"  $sysconf; then
    printf "the file aready set $sysconf  kernel.shmall  set next file  ....\n  ";
   else
    echo "kernel.shmall = 1073741824" >> $sysconf;
   fi
  
  if grep "kernel.shmmax"  $sysconf; then
    printf "the file aready set $sysconf  kernel.shmmax set next file  ....\n  ";
   else
    echo "kernel.shmmax = 4398046511104" >> $sysconf;
   fi
 fi
 
let i=$i+1;
printf "....................................................................$i \n";
 #note lines  "net.bridge.bridge-nf-call"
 sed -i 's/^net.bridge.bridge-nf-call/#net.bridge.bridge-nf-call/p' $sysconf

let i=$i+1;
printf "....................................................................$i \n";
 sysctl -p

let i=$i+1;
printf "....................................................................$i \n";
pamlogin='/etc/pam.d/login';
cp $pamlogin $pamlogin.$vardate;
 if grep "pam_limits.so"  $pamlogin; then
   printf "the file aready set $pamlogin   set next file  ....\n  ";
 else
  echo "#the next rows install oracle add" >> $pamlogin;
  echo "session    required     pam_limits.so" >> $pamlogin;
 fi

let i=$i+1;
printf "....................................................................$i \n";
etcprofile='/etc/profile';
cp $etcprofile $etcprofile.$vardate;
 if grep "oracle"  $etcprofile; then
   printf "the file aready set etc-profile   set next file  ....\n  ";
 else
  echo "#the next rows install oracle add" >> $etcprofile;
  echo 'if [ $USER = "oracle" ]; then' >> $etcprofile;
          echo '  if [ $SHELL = "/bin/ksh" ]; then' >> $etcprofile;
                  echo "    ulimit -p 16384" >> $etcprofile;
                  echo "    ulimit -n 65536" >> $etcprofile;
          echo "  else" >> $etcprofile;
                  echo "    ulimit -u 16384 -n 65536" >> $etcprofile;
          echo "  fi" >> $etcprofile;
          echo "fi" >> $etcprofile;
 fi

let i=$i+1;
printf "....................................................................$i \n";
printf "the change user oracle for add .bash_profile parameters.....\n  ";
bashprofile='/home/oracle/.bash_profile';
cp $bashprofile $bashprofile.$vardate;
 if grep "oracle"  $bashprofile; then
   printf "the file aready set bashprofile   set next file  ....\n  ";
 else
  echo "#the next rows install oracle add" >> $bashprofile;
  echo 'export TMP=/tmp' >> $bashprofile;
  echo 'export TMPDIR=$TMP' >> $bashprofile;
  echo "ORACLE_BASE=$orasetdir" >> $bashprofile;
  echo 'ORACLE_HOME=$ORACLE_BASE/oracle11g' >> $bashprofile;
  echo "ORACLE_SID=$dbsid" >> $bashprofile;
  echo 'PATH=$ORACLE_HOME/bin:$PATH' >> $bashprofile;
  echo 'NLS_LANG=AMERICAN_AMERICA.ZHS16GBK' >> $bashprofile;
  echo 'export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH NLS_LANG' >> $bashprofile;
 fi

let i=$i+1;
printf "....................................................................$i \n";
printf "set is end ,reboot system too setup!! go to fly ~.~  ~.~  \n";

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

亮亮-乡村

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值