CentOs中安装Oracle的脚本文件

来源:互联网 发布:steam mac windows 编辑:程序博客网 时间:2024/06/06 03:29


    #!/bin/sh

    # need to be centos 5.8

    echo "install dep. packages"

    yum install libgomp glibc-devel kernel-headers glibc-headers \

    libstdc++-devel sysstat compat-libstdc++-33 libaio-devel gcc \

    gcc-c++ elfutils-libelf-devel-static libtermcap-devel unixODBC-devel \

    libaio-devel compat-db compat-gcc-34 compat-gcc-34-c++ gdb libXp libstdc++-devel

    echo "add users"

    /usr/sbin/groupadd oinstall

    /usr/sbin/groupadd dba

    /usr/sbin/groupadd oper

    /usr/sbin/useradd -g oinstall -G dba,oper oracle

    passwd oracle

    echo "change sysctl.conf"

    cat 《!SYSCTL! 》 /etc/sysctl.conf

    kernel.shmall = 2097152

    kernel.shmmax = 2147483648

    kernel.shmmni = 4096

    kernel.sem = 250 32000 100 128

    fs.file-max = 65536

    net.ipv4.ip_local_port_range = 1024 65000

    net.core.rmem_default = 1048576

    net.core.rmem_max = 1048576

    net.core.wmem_default = 262144

    net.core.wmem_max = 262144

    !SYSCTL!

    /sbin/sysctl -p

    echo "change limits.conf"

    cat 《!LIMITS! 》 /etc/security/limits.conf

    oracle soft nproc 2047

    oracle hard nproc 16384

    oracle soft nofile 1024

    oracle hard nofile 65536

    !LIMITS!

    echo "change pam/login"

    cat 《!LOGIN! 》 /etc/pam.d/login

    session required /lib/security/pam_limits.so

    session required pam_limits.so

    !LOGIN!

    echo "change profile"

    cat 《!PROFILE! 》 /etc/profile

    if [ $USER = "oracle" ]; then

    if [ $SHELL = "/bin/ksh" ]; then

    ulimit -p 16384

    ulimit -n 65536

    else

    ulimit -u 16384 -n 65536

    fi

    fi

    !PROFILE!

    echo "mkdir for oracle"

    mkdir -p /oracle/product/10.2.0/db_1

    mkdir -p /oracle/oraInventory

    mkdir -p /oracle/oradata

    mkdir -p /oracle/flash_recovery_area

    chown -R oracle:oinstall /oracle

    chmod -R 775 /oracle

    echo "change .bash_profile"

    cat 《!BASH! 》 /home/oracle/.bash_profile

    ORACLE_BASE=/oracle ; export ORACLE_BASE

    ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1 ; export ORACLE_HOME

    PATH=$PATH:$ORACLE_HOME/bin ; export PATH

    !BASH!

    echo redhat-4 > /etc/redhat-release

下面是CentOS 6.2 x86_64安装oracle 11gR2 的环境准备脚本

    #!/bin/sh

    # preinstall script for oracle 11gR2 in CentOS 6.2 and later

    # make sure to understand what it do before run it

    #                                             by locke liu

    if [ "$UID" -eq "0" ]

    then

    continue

    else

    { echo "need to be root!"

    exit 1

    }

    fi

    echo "oracle require 1 GB of RAM , Recommend 2 GB of RAM or more . swap as the size of the RAM "

    grep MemTotal /proc/meminfo

    grep SwapTotal /proc/meminfo

    uname -a

    df -h /tmp

    df -h /oracle

    echo "update you system …"

    yum update -y

    echo "install dep packages …"

    yum install binutils compat-libcap1 compat-libstdc++-33 \

    gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ \

    libstdc++-devel libaio libaio-devel make sysstat unixODBC \

    unixODBC-devel java

    yum install compat-libstdc++-33.i686 glibc-devel.i686 \

    libgcc.i686 libstdc++.i686 glibc.i686 libstdc++-devel.i686 \

    libaio.i686 libaio-devel.i686 unixODBC.i686 unixODBC-devel.i686

    echo "add users"

    /usr/sbin/groupadd oinstall

    /usr/sbin/groupadd dba

    /usr/sbin/groupadd oper

    /usr/sbin/useradd -g oinstall -G dba,oper oracle

    passwd oracle

    echo "change sysctl.conf"

    cat 《!SYSCTL! 》 /etc/sysctl.conf

    fs.aio-max-nr = 1048576

    fs.file-max = 6815744

    kernel.shmall = 2097152

    kernel.shmmax = 536870912

    kernel.shmmni = 4096

    kernel.sem = 250 32000 100 128

    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 = 1048576

    !SYSCTL!

    /sbin/sysctl -p

    echo "change limits.conf"

    cat 《!LIMITS! 》 /etc/security/limits.conf

    oracle soft nproc 2047

    oracle hard nproc 16384

    oracle soft nofile 1024

    oracle hard nofile 65536

    oracle soft stack 10240

    !LIMITS!

    echo "mkdir for oracle"

    mkdir /oracle

    chown -R oracle:oinstall /oracle

    chmod -R 775 /oracle

    echo "change .bash_profile"

    cat 《!BASH! 》 /home/oracle/.bash_profile

    ORACLE_BASE=/oracle ; export ORACLE_BASE

    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 ; export ORACLE_HOME

    PATH=$PATH:$ORACLE_HOME/bin ; export PATH

    !BASH!


 

原创粉丝点击