Home  >  Article  >  Database  >  Oracle 安装脚本

Oracle 安装脚本

WBOY
WBOYOriginal
2016-06-07 16:56:06907browse

看了小布老师的Oracle安装视频,才发现Oracle安装真的很郁闷

  看了小布老师的Oracle安装视频,才发现Oracle安装真的很郁闷啊。没有什么难度就是前期准备的东西比较乱而已,所以自己编了一个安装脚本,包括修改主机名、设置内核变量,,创建用户 等一些准备活动。这样一来就不用再重复的做同样的工作了,下面就是我编的脚本外加安装笔记(昨天刚装完的Oracle,暂时没有时间试验呢):

  测试完成,有两处笔误已经修改完了。

  ####################################################################

  #!/bin/bash

  # oracle

  # 2009/03/12 first twtcom

  # set variable

  # ORACLE_BASE=/u1

  echo -n "Please enter HOSTNAME(default oracle):"

  read HOSTNAME

  if [ -z $HOSTNAME ]

  then

  HOSTNAME=oracle

  fi

  echo -n "Please enter ORACLE_BASE(default /u1):"

  read ORACLE_BASE

  if [ -z $ORACLE_BASE ]

  then

  ORACLE_BASE=/u1

  fi

  # ORACLE_HOME=$ORACLE_BASE/oracle

  echo -n "Please enter HOME(default oracle):"

  read HOME

  if [ -z $HOME ]

  then

  HOME=oracle

  fi

  ORACLE_HOME=$ORACLE_BASE/$HOME

  # ORACLE_SID=oral

  echo -n "Please enter ORACLE_SID(default oral):"

  read ORACLE_SID

  if [ -z $ORACLE_SID ]

  then

  ORACLE_SID=oral

  fi

  USER=oracle

  SYSCTL=/etc/sysctl.conf

  LIMITS=/etc/security/limits.conf

  PAM=/etc/pam.d/login

  PROFILE=/etc/profile

  BASH_PROFILE=$ORACLE_HOME/.bash_profile

  IPADDR=`ifconfig eth0|grep "inet addr"|cut -d : -f 2|cut -d ' ' -f 1`

  HOSTS=/etc/hosts

  NETWORK=/etc/sysconfig/network

  # hostname

  grep -v "HOSTNAME" $NETWORK > $NETWORK

  echo "HOSTNAME=$HOSTNAME" >> $NETWORK

  echo "$IPADDR  $HOSTNAME">> $HOSTS

  # useradd

  mkdir -p $ORACLE_BASE

  groupadd oinstall

  groupadd dba

  useradd -g oinstall -G dba -d $ORACLE_HOME $USER

  chown -R $USER:oinstall $ORACLE_BASE

  cat >> $SYSCTL

  kernel.shmall = 2097152

  kernel.shmmax = 2147483648

  kernel.shmmni = 4096

  kernel.sem = 250 32000 100 128

  net.ipv4.ip_local_port_range = 1024 65000

  net.core.rmem_default = 262144

  net.core.rmem_max = 4194304

  net.core.wmem_default = 262144

  net.core.wmem_max = 262144

  EOF

  cat >> $LIMITS

  oracle              soft    nproc   2047

  oracle              hard    nproc   16384

  oracle              soft    nofile  1024

  oracle              hard    nofile  65536

  EOF

  cat >> $PAM

  session    required     pam_limits.so

  EOF

linux

Statement:
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