wolong 发表于 2018-9-21 09:43:46

Oracle_052_lesson_p2

  Installing Oracle Software安装Oracle软件

  一般先安装GI,在安装DB。版本查询metalink.oracle.com      mos文件

  1、在root用户中执行脚本
  echo "192.168.132.120 dbserver" >> /etc/hosts
  echo "======================================"
  echo "The next will be created directory and group with users."
  echo "======================================"
  read -p "Press any key to continue:" var
  mkdir /u01/app/grid/product/11.2.0/grid -p
  mkdir /u01/app/oracle/product/11.2.0/db_1 -p
  groupadd dba
  useradd -g dba grid
  useradd -g dba oracle
  echo "Set password for oracle:"
  passwd oracle
  echo "Set password for grid:"
  passwd grid
  chown -R grid:dba /u01/app
  chown -R oracle:dba /u01/app/oracle
  chmod -R 775 /u01
  echo "======================================"
  echo "Setting local ISOforyum source."
  echo "======================================"
  mount -t iso9660 /dev/sr0 /media
  mkdir /etc/yum.repos.d/bak
  mv /etc/yum.repos.d/. /etc/yum.repos.d/bak/
  echo "======================================"
  echo "create yum configure file."
  echo "======================================"
  cat /etc/yum.repos.d/OLE6.repo
  
  name=Ole64
  baseurl=file:///media
  gpgcheck=0
  gpgkey=file:///media/RPM-GPG-KEY-oracle
  enabled=1
  EOF
  yum clean all
  yum makecache
  #install packagesfor Oracle GRID 11204
  echo "======================================"
  echo "The next will be installed depend on the package."
  echo "======================================"
  read -p "Press enter to continue:" var
  yum install -y binutilscompat-libstdc++-33 compat-libcap1 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibccommon
  glibc-devel libaio libaio-devel-0.libgcclibstdc++ libstdc++-devel make numactl sysstat libXp unixODBC
  unixODBC-devel readline xorg-x11-apps
  #disabled firewall and selinux
  echo "======================================"
  echo "To disable the firewall and Selinux"
  echo "======================================"
  service iptables stop
  chkconfig iptables off
  echo "SELINUX=disabled" > /etc/selinux/config
  echo "SELINUXTYPE=targeted" >> /etc/selinux/config
  setenforce 0
  #create partition for disks
  echo "======================================"
  echo "The next will be create partition for /dev/sdc."
  echo "======================================"
  fdisk /dev/sdc
  echo "======================================"
  echo "The next will be create partition for /dev/sdd."
  echo "======================================"
  fdisk /dev/sdd
  echo "======================================"
  echo "The next will be create partition for /dev/sde."
  echo "======================================"
  fdisk /dev/sde
  echo "======================================"
  echo "The next will be create partition for /dev/sdf."
  echo "======================================"
  fdisk /dev/sdf
  echo "======================================"
  echo "The next will be create partition for /dev/sdg."
  echo "======================================"
  fdisk /dev/sdg
  echo "======================================"
  echo "The next will be create partition for /dev/sdh."
  echo "======================================"
  fdisk /dev/sdh
  echo "======================================"
  echo "The next will be create partition for /dev/sdi."
  echo "======================================"
  fdisk /dev/sdi
  echo "======================================"
  echo "The next will be create partition for /dev/sdj."
  echo "======================================"
  fdisk /dev/sdj
  echo "======================================"
  echo " create udev raw configuration file:"
  echo "======================================"
  cat /etc/udev/rules.d/60-raw.rules
  ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw1 %N"
  KERNEL=="raw1", OWNER="grid",GROUP="dba", MODE="0666"
  ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw2 %N"
  KERNEL=="raw2", OWNER="grid",GROUP="dba", MODE="0666"
  ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw3 %N"
  KERNEL=="raw3", OWNER="grid",GROUP="dba", MODE="0666"
  ACTION=="add", KERNEL=="sdf1", RUN+="/bin/raw /dev/raw/raw4 %N"
  KERNEL=="raw4", OWNER="grid",GROUP="dba", MODE="0666"
  ACTION=="add", KERNEL=="sdg1", RUN+="/bin/raw /dev/raw/raw5 %N"
  KERNEL=="raw5", OWNER="grid",GROUP="dba", MODE="0666"
  ACTION=="add", KERNEL=="sdh1", RUN+="/bin/raw /dev/raw/raw6 %N"
  KERNEL=="raw6", OWNER="grid",GROUP="dba", MODE="0666"
  ACTION=="add", KERNEL=="sdi1", RUN+="/bin/raw /dev/raw/raw7 %N"
  KERNEL=="raw7", OWNER="grid",GROUP="dba", MODE="0666"
  ACTION=="add", KERNEL=="sdj1", RUN+="/bin/raw /dev/raw/raw8 %N"
  KERNEL=="raw8", OWNER="grid",GROUP="dba", MODE="0666"
  EOF
  echo "======================================"
  echo "start_udev"
  echo "======================================"
  start_udev
  echo "======================================"
  echo "Check the UDEV RAW equipment to create results"
  echo "======================================"
  raw -qa
  2、GRID用户执行下述脚本
  cat >/home/grid/test.txt
  export ORACLE_SID=+ASM
  export ORACLE_BASE=/u01/app/grid
  export ORACLE_HOME=/u01/app/grid/product/11.2.0/grid
  export PATH=$PATH:$ORACLE_HOME/bin
  aliassqlplus='rlwrap sqlplus'
  alias asmcmd='rlwrap asmcmd'
  EOF
  source /home/grid/.bash_profile
  env|grep ORA
  3、oracle用户执行下述脚本
  cat >/home/oracle/.bash_profile
  export ORACLE_SID=tech1
  export ORACLE_BASE=/u01/app/oracle
  export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
  export PATH=$PATH:$ORACLE_HOME/bin
  aliassqlplus='rlwrap sqlplus'
  aliasrman='rlwrap rman'
  EOF
  source /home/oracle/.bash_profile
  env|grep ORA
  partprobe使能分区立即生效
  ls /dev/raw/*
  1、创建组,用户
  2、创建目录,权限
  3、系统,防火墙,selinux
  4、准备ASM disk
  5、环境变量 添加
  grid 用户下,ASMCA 创建快速恢复区
  grid 用户下, crs_stat -t(6个在线,2个离线即OK)

页: [1]
查看完整版本: Oracle_052_lesson_p2