#!/bin/bash

#Test in RHEL 5.5 for 11g

c=`cat /etc/shadow | grep oracle | wc -l`
if [ $c != 0 ]
then
  w=0
  while [ $w -eq 0 ]
  do
    echo "--Find user oracle has been existed!--"
    echo "--Do you want to delete user oracle?[yes/no]:"
    read yn
      case $yn in
        "yes")
         gpasswd -d oracle dba
         userdel -r oracle
         rm -fr /home/oracle
         echo "--User oracle has been deleted.--"
         /usr/sbin/groupadd oinstall
         /usr/sbin/groupadd dba
         /usr/sbin/useradd -g oinstall -G dba  oracle
         echo "--Please set user oracle's password--"
         passwd oracle
         echo "--password is ok!--"
         w=1
         ;;
        "no")
         echo "--I will not delete user oracle!--"
         w=1
         ;;
        *)
         echo "--Please input yes or no!--"
         w=0
        ;;
      esac
  done
else
  /usr/sbin/groupadd oinstall
  /usr/sbin/groupadd dba
  /usr/sbin/useradd -g oinstall -G dba  oracle
  echo "--Please set user oracle's password."
  passwd oracle
  echo "--password is ok!--"
fi

mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01

sed -i '/kernel.shmmax/d' /etc/sysctl.conf
sed -i '/kernel.shmall/d' /etc/sysctl.conf
sed -i '/kernel.shmmni/d' /etc/sysctl.conf
sed -i '/kernel.sem/d' /etc/sysctl.conf
sed -i '/fs.file-max/d' /etc/sysctl.conf
sed -i '/net.ipv4.ip_local_port_range/d' /etc/sysctl.conf
sed -i '/net.core.rmem_default/d' /etc/sysctl.conf
sed -i '/net.core.rmem_max/d' /etc/sysctl.conf
sed -i '/net.core.wmem_default/d' /etc/sysctl.conf
sed -i '/net.core.wmem_max/d' /etc/sysctl.conf

sed -i "/#fordelbegin/,/#fordelend/d" /etc/sysctl.conf
cat >> /etc/sysctl.conf << "EOF"
#fordelbegin#################################
#use for oracle
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
#fordelend
EOF

/sbin/sysctl -p
echo "--/ect/sysctl.conf is ok!--"

sed -i "/#fordelbegin/,/#fordelend/d" /etc/security/limits.conf
cat >> /etc/security/limits.conf << "EOF"
#fordelbegin#################################
#use for oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
#fordelend
EOF
echo "--/etc/security/limits.conf is ok!--"

sed -i "/#fordelbegin/,/#fordelend/d" /etc/pam.d/login
cat >> /etc/pam.d/login << "EOF"
#fordelbegin#################################
#use for oracle
#session required /lib64/security/pam_limits.so  #for 64
session required /lib/security/pam_limits.so     #for 32
session required pam_limits.so
#fordelend
EOF
echo "--/etc/pam.d/login is ok!--"

sed -i "/#fordelbegin/,/#fordelend/d" /etc/profile
cat >> /etc/profile << "EOF"
#fordelbegin#################################
#use for oracle
if [ $USER = "oracle" ]; then         
    if [ $SHELL = "/bin/ksh" ]; then              
      ulimit -p 16384              
      ulimit -n 65536          
    else              
      ulimit -u 16384 -n 65536             
    fi
fi
#fordelend
EOF
echo "--/etc/profile is ok!--"

sed -i "/#fordelbegin/,/#fordelend/d" /home/oracle/.bash_profile
cat >> /home/oracle/.bash_profile << "EOF"
#fordelbegin#################################
#use for oracle
umask 022
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=db01
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH NLS_LANG
#fordelend
EOF

echo "--Please set you oracle_sid:"
read orasid
sed -i "s/db01/$orasid/g" /home/oracle/.bash_profile

source /home/oracle/.bash_profile
echo "--/home/oracle/.bash_profile is ok!--"

echo "--Config is OK!--"
echo "--Dont forget to vi your /etc/hosts.--"

Oracle 11g 安装环境配置脚本的更多相关文章

  1. Oracle 10g 安装环境配置脚本

    #!/bin/bash #Test in RHEL 5.5 for 10g c=`cat /etc/shadow | grep oracle | wc -l`if [ $c != 0 ]then  w ...

  2. Oracle 11g DRCP配置与使用

    Oracle 11g DRCP配置与使用Oracle 11g推出了驻留连接池(Database Resident Connection Pool)特性,提供了数据库层面上的连接池管理机制,为应对高并发 ...

  3. Oracle 11g监听器配置

    Oracle 11g监听器配置 安装好oracle后,出现oracle监听器不能正确使用的问题,先后遇到问题: 1.Oracle ORA-12541:TNS:no listener 2.ORA-285 ...

  4. Oracle 11g DG配置简明版

    环境: 主库A机:在线生产环境,RHEL 6.4 + Oracle 11.2.0.3 备库B机:新增备机,RHEL 6.4 需求: 对生产环境最小影响前提下配置DG备库. 目录: 一.B机安装相同版本 ...

  5. oracle 11g dblink配置

    关于DBLINK的概念在本文中不再赘述,本文主要介绍DBLINK的创建. 1.创建环境描述 本文将在两台操作系统为红帽5.5版本.装有Oracle 11g的虚拟机中进行DBLINK的创建以及测试工作. ...

  6. Oracle安装部署之RAC安装环境配置脚本

    #!/bin/bash#Usage:Log on as the superuser('root'),and then execute the command:#./1preusers.sh group ...

  7. Oracle 11g Dataguard 配置,维护与详解 (ADG)

    一.前言: 本手册主要记录如何配置,还介绍了配置原因,以及注意要点,已经主备切换,以及故障转移等重要操作步骤,我希望这个文章可以作为进行dataguard配置的一个参考手册. 二.前提 1.主库是归档 ...

  8. Oracle 11g 静默安装脚本

    #!/bin/bash####安装Oracle所需依赖包function install_yum(){  yum -y install $1} i="perl-Data-Dumper lvm ...

  9. 【Docker】拉取Oracle 11g镜像配置

    以下是基于阿里云服务器Centos 7操作 1.拉取Oracle11g镜像 docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_1 ...

随机推荐

  1. C++ STL容器——stack用法介绍

    stack是一种容器适配器,专门设计用于在LIFO上下文中操作(后进先出),其中元素仅从容器的一端插入和删除. 容器适配器,而不是一种容器. 它是容器适配器是指,只要支持一系列方法的容器(empty, ...

  2. Linux SPI总线和设备驱动架构之三:SPI控制器驱动

    通过第一篇文章,我们已经知道,整个SPI驱动架构可以分为协议驱动.通用接口层和控制器驱动三大部分.其中,控制器驱动负责最底层的数据收发工作,为了完成数据的收发工作,控制器驱动需要完成以下这些功能:1. ...

  3. lintcode-117-跳跃游戏 II

    117-跳跃游戏 II 给出一个非负整数数组,你最初定位在数组的第一个位置. 数组中的每个元素代表你在那个位置可以跳跃的最大长度. 你的目标是使用最少的跳跃次数到达数组的最后一个位置. 样例 给出数组 ...

  4. Java中Model1和Model2

    Model1和Model2是java web的两种架构模式.这两种模式各有优缺点,都有各自适合使用的场景. Model1 首先,从分层的角度说,Model1模式可以看作是由两层组成:视图层和模型层. ...

  5. Object empty value key filter

    Object empty value key filter 过滤空值 Utils emptykeysFilter() "use strict"; /** * * @author x ...

  6. Eclipse的优化方案

    General > Startup and Shutdown : 移除所有在启动时加载的插件. General > Editors > Text Editors > Spell ...

  7. BZOJ 3876:支线剧情(有下界最小费用最大流)

    3876: [Ahoi2014]支线剧情 Description [故事背景]宅男JYY非常喜欢玩RPG游戏,比如仙剑,轩辕剑等等.不过JYY喜欢的并不是战斗场景,而是类似电视剧一般的充满恩怨情仇的剧 ...

  8. [洛谷P3935]Calculating

    题目大意:设把$x$分解质因数的结果为$x=p_1^{k_1}p_2^{k_2}\cdots p_n^{k_n}$,令$f(x)=(k_1+1)(k_2+1)\cdots (k_n+1)$,求$\su ...

  9. 2014end

    人.事.物. 人一年了,从十六班到十六班,从j101到j101再到A207. 她:结婚,然后走了.就是这样,干脆得我都来不及留恋.是的,再也听不到她那很温柔语气,看不到她偶尔激动时就踮起脚尖.还记得晚 ...

  10. 洛谷 P2893 [USACO08FEB]修路Making the Grade 解题报告

    P2893 [USACO08FEB]修路Making the Grade 题目描述 A straight dirt road connects two fields on FJ's farm, but ...