ORACLE 11G 6.2 安装

来源:互联网 发布:流程引擎 java 编辑:程序博客网 时间:2024/06/05 08:25

#!/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";

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 安卓手机老是收到垃圾短信怎么办 高铁站行李拉安检仪上应该怎么办 连壁金融立案了投资钱怎么办 联壁金融倒了投资人的钱怎么办 改签的高铁票错过了怎么办 高铁票错过了当天没别的车次怎么办 电脑文件剪切到u盘不见了怎么办 电脑剪切到u盘然后打不开了怎么办 淘宝未满十八岁限制购买物品怎么办 网上飞机订票手机号填写错了怎么办 室外回填土都是砂土压不实怎么办 王牌车新车储气筒漏气查不到怎么办 顺丰快递保价后商品出现问题怎么办 未保价快递丢失没有价值证明怎么办 安卓手机谷歌地图怎么用不了怎么办 ae模板版本太高打不开怎么办 苹果手机高德地图信号弱怎么办 网上订好火车票后没赶上火车怎么办 丰巢快递柜没收到短信怎么办 被不同号码骚扰电话打个不停怎么办 手机注册被骚扰电话打个不停怎么办 网贷不停的打骚扰电话怎么办 发改委的可研报告过期了怎么办 买到没有预售证的房子怎么办 网上买的学生票取不出来怎么办 买完学生票发现打折没次数了怎么办 动车晚点方向来反了怎么办 身份证购买高铁票过不了审核怎么办 手机购买高铁票身份核验失败怎么办 在高铁上如果有人占了座位该怎么办 网上买的高铁票改签怎么办 临沂村委会强行征收我的土地怎么办 学籍验证码连续输入三次错误怎么办 社保在上海个税在外地居转户怎么办 父母已经有英国签证孩子的怎么办 营运车辆被撞不肯赔务工费怎么办 欧米茄外壳上装表带的孔穿了怎么办 淘宝上买了电子产品坏了怎么办 研究生人才补助申请期限过了怎么办 一个小孩亲妈愿意养躲起来怎么办 网银转账名字打错了怎么办