当前位置:数据库 > Oracle >>

redhat linux 5 oracle install shell script

redhat linux 5 oracle install shell script
 
#!/bin/bash
echo "下载ORACLE安装依赖文件"
yum install -y compat-db pdksh sysstat screen libXp compat-libstdc++*
yum install gcc-c++  glibc libstdc++ libstdc++-devel make libaio-devel readline-devel gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel pdksh xscreensaver setarch
 
echo "添加ORACLE用户组"
groupadd  oinstall
groupadd  dba
 
echo "添加ORACLE管理用户"
useradd -g oinstall -G dba oracle
 
echo "生成ORACLE系统检测文件 redhat-release"
mv /etc/redhat-release /etc/redhat-release.bak
touch /etc/redhat-release
echo "redhat-4" > /etc/redhat-release
echo "显示ORACLE系统检测文件内容"
cat /etc/redhat-release
 
echo "调整系统资源参数限制"
echo "#-----------oracle os system paramter add ------------------" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf 
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf 
echo "fs.file-max = 65536" >> /etc/sysctl.conf 
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf 
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf 
echo "net.core.rmem_max = 262144" >> /etc/sysctl.conf 
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf 
echo "net.core.wmem_max = <262144></262144>" >> /etc/sysctl.conf 
 
echo "显示系统资源调整参数"
cat /etc/sysctl.conf
echo "------------系统参数生效--------------------"
sysctl -p
 
echo "修改ORACLE管理用户资源限制"
echo "#---------------ORACLE SYSTEM EDIT------------------"
echo "oracle              soft    nproc   2047" >> /etc/security/limits.conf
echo "oracle              hard    nproc   16384" >> /etc/security/limits.conf
echo "oracle              soft    nofile  1024" >> /etc/security/limits.conf
echo "oracle              hard    nofile  65536" >> /etc/security/limits.conf
 
echo "修改/etc/pam.d/login"
echo "#-----------oracle pam login edit-------------------"
echo "session    required     pam_limits.so" >> /etc/pam.d/login
echo "显示/etc/pam.d/login修改内容"
 
cat /etc/pam.d/login
echo "修改/etc/profile 修改ORACLE管理用户系统资源限制"
cat<<EOF>> /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
EOF
 
echo "创建ORACLE_BASE ORACLE_HOME"
mkdir -p /u01/app/oracle/product/10.2.0/db_1/
chown -R oracle:oinstall /u01/app/oracle/
echo "修改临时文件夹写权限"
chmod 777 /tmp/
cat<<EOF>>/home/oracle/.bash_profile
TMP=/tmp
export TMP
TMPDIR=$TMP
export TMPDIR
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_HOME
ORACLE_SID=易做图t
export ORACLE_SID
ORACLE_TERM=xterm
export ORACLE_TERM
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export CLASSPATH
ORACLE_HOSTNAME=oradb
export ORACLE_HOSTNAME
PATH=/usr/sbin:$PATH
export PATH
PATH=$ORACLE_HOME/bin:$PATH
export PATH
EOF
 
su oracle
source /home/oracle/.bash_pfofile
cd /tmp/database
./runInstaller -silent -responseFile /tmp/database/response/user_enterprise.rsp
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,