• OraclePre.sh


    #!/bin/bash
    set -x
    #
    #
    ############################
    #Define global variable
    CWD=$(pwd)
    ORA_INST_DIR=/u01/app
    ORA_SID=hworcl
    ORA_HOSTNAME=localhost
    
    # Oracle database version
    ORA_VER=12.1.0
    
    # database software PKG
    DBPKG="*.zip"
    
    ############################
    
    #创建oracle用户
    groupadd -g 51111 oinstall
    groupadd -g 51112 dba
    useradd  -u 51112 -g oinstall -G dba oracle
    
    #创建目录并赋权
    mkdir -p ${ORA_INST_DIR}/{data,oracle}
    chown -R oracle:oinstall ${ORA_INST_DIR}
    chmod -R 775 ${ORA_INST_DIR}
    
    
    if [ ${DBPKG} -eq "" ];then
      echo DBPKG is not exists!!
      exit 1
    fi
    
    su - oracle <<< "unzip ${CWD}/*.zip -d ${ORA_INST_DIR}/data/" 
    
    
    yum install -y readline-devel binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.i686 libX11 libX11*.i686 libXau libXau*.i686 libXi libXi*.i686 libXtst libXtst*.i686 libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686  libxcb libxcb*.i686 make nfs-utils net-tools smartmontools sysstat unixODBC unixODBC-devel gcc gcc-c++ libXext libXext*.i686 zlib-devel zlib-devel*.i686 unzip readline-devel
    
    wget https://github.com/hanslub42/rlwrap/releases/download/v0.45.2/rlwrap-0.45.2.tar.gz
    tar xf rlwrap-0.45.2.tar.gz && cd rlwrap-0.45.2 && ./configure && make && make install
    
    
    #####################################
    #关闭防火墙,禁止防火墙开机自启
    systemctl stop firewalld.service && systemctl disable firewalld.service
    
    #禁用SELINUX
    setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
    
    cat>>/etc/sysctl.conf<<EOF
    # Oracle database 12c
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.shmall = 2097152
    kernel.shmmax = 6442450944
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    kernel.panic_on_oops = 1
    net.ipv4.ip_local_port_range = 9000 65500
    net.core.rmem_default = 262144
    net.core.rmem_max = 4194304
    net.core.wmem_default = 262144
    net.core.wmem_max = 1048586
    EOF
    sysctl -p /etc/sysctl.conf
    
    
    cat>>/etc/security/limits.d/20-nproc.conf<<EOF
    # Oracle database 12c
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    oracle soft stack 10240
    EOF
    
    cat>>/etc/pam.d/login<<EOF
    # Oracle database 12c
    session required /lib64/security/pam_limits.so
    session required pam_limits.so
    EOF
    
    
    #关闭内存大叶
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
    
    #oracle用户环境变量
    cat>>/home/oracle/.bash_profile<<EOF
    # Oracle database 12c
    export ORACLE_VERSION=${ORA_VER}
    export ORACLE_BASE=${ORA_INST_DIR}/oracle
    export ORACLE_HOME=${ORACLE_BASE}/product/${ORACLE_VERSION}/db_1
    export ORACLE_SID=${ORA_SID}
    export PATH=$PATH:$ORACLE_HOME/bin
    alias sqlplus='rlwrap sqlplus'
    alias rman='rlwrap rman'
    export LC_ALL="en_US"
    export LANG="en_US"
    export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
    export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
    EOF
    
    cat>>/etc/profile<<'EOF'
    if [ $USER = "oracle" ]; then
       if [ $SHELL = "/bin/ksh" ]; then
           ulimit -p 16384
           ulimit -n 65536
        else
           ulimit -u 16384 -n 65536
       fi
    fi
    EOF
    source /home/oracle/.bash_profile
    source /etc/profile
    
    ls ${ORA_INST_DIR}/data/
  • 相关阅读:
    ABAP TCode
    SAP 常用的事务代码
    SAP FI TCode
    Little Tutorials的一篇文章断言:UML(统一建模语言)正在死亡:
    SAP PP TCode
    [ZT]解密中国IT人十大职业现状
    User Exit Query
    SAP客户端多语言设置
    一个女CIO的诞生
    DIY防奸手册之 主流硬盘型号解惑篇
  • 原文地址:https://www.cnblogs.com/vmsysjack/p/15150031.html
Copyright © 2020-2023  润新知