• [Oracle]-Oracle_script


    YUM script

    #!/bin/bash
    rm -rf /etc/yum.repos.d/*
    echo "
    [yum]
    name=yum
    baseurl=file:///mnt/
    enabled=1
    gpgcheck=0
    " > /etc/yum.repos.d/yum.repo
    mount /dev/cdrom /mnt &> /dev/null
    yum clean all
    yum makecache

     Oracle script

    #!/bin/bash
    #配置ip:
    sed -i "s/ONBOOT=no/ONBOOT=yes/g" /etc/sysconfig/network-scripts/ifcfg-eth0
    sed -i "s/BOOTPROTO=dhcp/BOOTPROTO=static/g" /etc/sysconfig/network-scripts/ifcfg-eth0
    echo "IPADDR=172.16.1.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0
    echo "NETMASK=255.255.255.0" >>/etc/sysconfig/network-scripts/ifcfg-eth0
    service network restart &> /dev/null
    #关闭Selinux:
    getenforce &> /dev/null
    #关闭防火墙:
    service iptables stop &> /dev/null
    #修改主机名:
    hostname oracle.com
    bash
    #域名解析:
    echo  "172.16.1.1     oracle.benet.com" >>  /etc/hosts
    #调整内核参数:
    echo "fs.aio-max-nr = 1048576" >>/etc/sysctl.conf
    echo "fs.file-max = 6815744" >>/etc/sysctl.conf
    echo "kernel.shmmni = 4096" >>/etc/sysctl.conf
    echo "kernel.sem = 250 32000 100 128" >>/etc/sysctl.conf
    echo "net.ipv4.ip_local_port_range = 9000 65500" >>/etc/sysctl.conf
    echo "net.core.rmem_default = 262144" >>/etc/sysctl.conf
    echo "net.core.rmem_max = 4194304" >>/etc/sysctl.conf
    echo "net.core.wmem_default = 262144" >>/etc/sysctl.conf
    echo "net.core.wmem_max = 1048586" >>/etc/sysctl.conf
    #准备系统软件环境:
    yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel &> /dev/null
    
    rpm -e ksh &> /dev/null
    rpm -ivh pdksh-5.2.14-36.el5.i386.rpm &> /dev/null
    rpm -ivh ksh-20100202-1.el5.i386.rpm &> /dev/null
    
    mkdir -p /usr/share/fonts/zh_CN/TrueType
    unzip Oracle字体库zysong.zip  &> /dev/null
    cp zysong.ttf /usr/share/fonts/zh_CN/TrueType/
    #创建用户:
    groupadd -g 66 oinstall
    groupadd -g 77 oracle
    useradd -g oinstall -G oracle oracle
    echo123.com‘ | passwd --stdin oracle &> /dev/null
    #赋予权限:
    mkdir /opt/oracle
    chown -R oracle:oinstall /opt/oracle
    chmod -R 775 /opt/oracle
    #添加:
    echo 'umask 022' >>/home/oracle/.bash_profile
    echo 'export ORACLE_BASE=/opt/oracle' >>/home/oracle/.bash_profile
    echo 'export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1' >>/home/oracle/.bash_profile
    echo 'export ORACLE_SID=orcl' >>/home/oracle/.bash_profile
    echo 'export LANG=zh_CN.UTF-8' >>/home/oracle/.bash_profile
    echo 'export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"' >>/home/oracle/.bash_profile
    echo 'export PATH=$ORACLE_HOME/bin:$PATH' >>/home/oracle/.bash_profile
    echo "export DISPLAY=:0.0" >>/home/oracle/.bash_profile
    #资源限制:
    echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
    echo "session required pam_limits.so" >>/etc/pam.d/login
    #资源限制:
    echo "oracle soft nproc 8192" >>/etc/security/limits.conf
    echo "oracle hard nproc 16384" >>/etc/security/limits.conf
    echo "oracle soft nofile 32768" >>/etc/security/limits.conf
    echo "oracle hard nofile 65536" >>/etc/security/limits.conf
    echo "oracle soft stack 10240" >>/etc/security/limits.conf
    
    mkdir /mnts
    mount /dev/cdrom1 /mnts
    mkdir /database cp -r /mnts/* /database/ xhost + &> /dev/null xhost + &> /dev/null su - oracle cd /database/ ./runInstaller

    安装两个光盘

    centos6.5挂载到/mnt下

    Oracle挂载到自定义的/mnts下

    注意第一次挂载的事cdrom,第二个是cdrom2

    oracle.sh脚本注:执行完成脚本 须重新启动虚拟机 

    重启之后在root界面重新执行xhost + ,否则会报错

  • 相关阅读:
    2014年去哪儿网笔试题--一个10*10的矩阵(可以理解为棋盘),随时生成一组数据填入矩阵,任何一个位置的数字除4进行计算,按余数着色...
    2014年去哪儿网笔试题--给定一个整型数组,对这个整型素组排序,使得按序拼接数组各元素得到的值最小。
    剑指Offer:面试题25
    字符串模式匹配KMP算法
    堆排序算法原理
    HashMap和HashTable 学习
    JAVA的IO学习
    输出图片的php代码前面不能有空白行
    PHP中最容易忘记的一些知识点总结
    PHP中cookie与session总结
  • 原文地址:https://www.cnblogs.com/chenwz/p/7856249.html
Copyright © 2020-2023  润新知