这几天一直在做测试环境,在各种平台下安装,复制粘贴不太方便,看到一本书书上一个脚本自动创建初始环境,非常方便。
我将该脚本上传至百度云
点击(此处)折叠或打开
-
#!/bin/bash
-
if [ ! $1 ] || [ ! $2 ]
-
then
-
echo "execute error,please input sid and oracle basic home path"
-
exit
-
fi
-
-
yum install -y binutils* compat-libstdc++* elfutils-libelf* elfutils-libelf-devel* elfutils-libelf-devel-static* 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* openmotif* compat-lib* compat-gcc*
-
-
/usr/sbin/groupadd -g 501 oinstall
-
/usr/sbin/groupadd -g 502 dba
-
/usr/sbin/groupadd -g 503 asmadmin
-
/usr/sbin/groupadd -g 504 asmdba
-
/usr/sbin/useradd -g oinstall -G dba,asmadmin,asmdba oracle
-
echo oracle | passwd oracle --stdin
-
-
-
mkdir -p $2/oracle/app/oraInventory
-
mkdir -p $2/oracle/app/grid
-
mkdir -p $2/oracle/app/oracle
-
chown -R oracle:oinstall $2/oracle/app/
-
chown -R oracle:oinstall $2/oracle/app/oraInventory
-
chown -R oracle:oinstall $2/oracle/app/grid
-
chown -R oracle:oinstall $2/oracle/app/oracle
-
chmod -R 775 $2/oracle/app/
-
chmod -R 775 $2/oracle/app/oraInventory
-
chmod -R 775 $2/oracle/app/oracle
-
chmod -R 775 $2/oracle/app/grid
-
-
cat > /home/oracle/.bash_grid_profile <<EOF
-
export PATH=$PATH:$HOME/bin
-
export TMP=/tmp
-
export TMPDIR=$TMP
-
export ORACLE_SID=+ASM
-
export ORACLE_BASE=$2/oracle/app/oracle
-
export ORACLE_HOME=$2/oracle/app/grid/product/11.2.0
-
export CVUQDISK_GRP=oinstall
-
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
-
export THREADS_FLAG=native
-
export PATH=$2/oracle/app/grid/product/11.2.0/bin:$PATH
-
EOF
-
-
-
cat > /home/oracle/.bash_profile <<EOF
-
export PATH=$PATH:$HOME/bin
-
export TMP=/tmp
-
export TMPDIR=$TMP
-
export ORACLE_BASE=$2/oracle/app/oracle
-
export ORACLE_HOME=$2/oracle/app/oracle/product/11.2.0
-
export ORACLE_SID=$1
-
export ORACLE_TERM=xterm
-
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
-
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
-
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
-
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
-
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
-
EOF
-
-
-
-
-
cat >> /etc/security/limits.conf <<EOF
-
oracle soft nproc 2047
-
oracle hard nproc 16384
-
oracle soft nofile 1024
-
oracle hard nofile 65536
-
EOF
-
-
-
echo "session required pam_limits.so ">> /etc/pam.d/login
-
-
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
-
-
cat >>/etc/sysctl.conf <<EOF
-
fs.aio-max-nr = 1048576
-
fs.file-max = 6815744
-
kernel.shmall = 2097152
-
kernel.shmmax = 4294967295
-
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 = 1048586
-
EOF
-
- sysctl -p
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30430420/viewspace-1798109/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30430420/viewspace-1798109/