#!/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. django视图之分页

    在网站开发时,肯定会遇到分页的事情需要处理,在django中也是如此,在Django中处理分页一般会使用到两个类django.core.paginator.Paginator和django.core. ...

  2. 移动端webapp如何隐藏浏览器的导航栏

    webapp如何隐藏浏览器的导航栏 在webapp开发中,手机浏览器的导航栏会让我们的页面看起来很怪异,这个时候我们就需要将导航栏给隐藏起来,隐藏的方法十分简单,只需要在head头中加入以下几行代码就 ...

  3. css3弹性盒子模型之box-flex

    css3弹性盒子模型之box-flex 浏览器支持 目前没有浏览器支持 box-flex 属性. Firefox 支持替代的 -moz-box-flex 属性. Safari.Opera 以及 Chr ...

  4. 多线程&&I/O

    不是操作系统的,是UNIX环境高级编程的!

  5. 福大软工1816:Alpha(3/10)

    Alpha 冲刺 (3/10) 队名:第三视角 组长博客链接 本次作业链接 团队部分 团队燃尽图 工作情况汇报 张扬(组长) 过去两天完成了哪些任务: 文字/口头描述: 1.学习qqbot库: 2.实 ...

  6. 【bzoj1260】[CQOI2007]涂色paint 区间dp

    题目描述 给出一个序列,每次可以给一段染成同一种颜色,问最少要染多少次能够染成给定方案. 输入 输入仅一行,包含一个长度为n的字符串,即涂色目标.字符串中的每个字符都是一个大写字母,不同的字母代表不同 ...

  7. 【bzoj1176】[Balkan2007]Mokia/【bzoj2683】简单题 CDQ分治+树状数组

    bzoj1176 题目描述 维护一个W*W的矩阵,初始值均为S(题目描述有误,这里的S没有任何作用!).每次操作可以增加某格子的权值,或询问某子矩阵的总权值.修改操作数M<=160000,询问数 ...

  8. 【题解】CQOI2015任务查询系统

    主席树,操作上面基本上是一样的.每一个时间节点一棵树,一个树上的每个节点代表一个优先级的节点.把开始和结束时间点离散,在每一棵树上进行修改.注意因为一个时间节点可能会有多个修改,但我们要保证都在同一棵 ...

  9. gcc用法小记

    By francis_hao    Feb 13,2017 概要 这里只列出了最常用的选项   选项解释 -c|-S|-E 启动gcc编译器时,它会顺序执行预处理.编译.汇编和连接(四个阶段的详细介绍 ...

  10. HDU 1556 线段树/树状数组/区间更新姿势 三种方法处理

    Color the ball Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...