#!/bin/bash
#centos
#將所需要安裝的包(rpm格式)與腳本放在一個目錄下
ss=$PWD
cd $ss
rpm
#ORACLE_BASE=/opt/oracle
echo
read ORACLE_BASE
if [
then
ORACLE_BASE=/opt/oracle
fi
#ORACLE_HOME=$ORACLE_BASE/product/
echo
read HOME
if [
then
HOME=product/
fi
ORACLE_HOME=$ORACLE_BASE/$HOME
#ORACLE_SID=oral
echo
read ORACLE_SID
if [
then
ORACLE_SID=orcl
fi
USER=oracle
SYSCTL=/etc/nf
LIMITS=/etc/security/nf
PAM=/etc/pam
PROFILE=/etc/profile
BASH_PROFILE=/home/oracle/
#IPADDR=`ifconfig eth
#HOSTS=/etc/hosts
#NETWORK=/etc/sysconfig/network
#hostname
#grep
#echo
#echo
#加入用戶
useradd
groupadd oinstall
groupadd dba
mkdir
chown
#內核設置
cat >> $SYSCTL << EOF
kernel
kernel
kernel
fs
net
net
net
net
net
re
re
re
re
EOF
#限制設置
cat>> $LIMITS <<EOF
oracle soft nproc
oracle hard nproc
oracle soft nofile
oracle hard nofile
EOF
#安全設置
cat >> $PAM <<EOF
session required /lib/security/pam_limits
session required pam_limits
EOF
#全局環境變量設置
cat >> $PROFILE <<EOF
if [ \$USER =
if [ \$SHELL =
ulimit
ulimit
else
ulimit
fi
fi
EOF
#oracle環境變量設置
cat >> $BASH_PROFILE <<EOF
export LC_CTYPE=en_US
export ORACLE_SID=orcl
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_DB=$ORACLE_HOME/dbs
export ORACLE_BDUMP=$ORACLE_BASE/shtkt/bdump
export ORACLE_TERM=xterm
export NLS_LANG=AMERICAN_AMERICA
export ORA_NLS
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
export CLASSPATH=$ORACLE_HOME/JRE/lib:$ORACLE_HOME/JRE/lib/rt
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
umask
EOF
source /home/oracle/
sleep
export DISPLAY=:
xhost +
export LC_ALL=en_US
/sbin/sysctl
From:http://tw.wingwit.com/Article/program/Oracle/201311/18577.html