当前位置:Gxlcms > mysql > FastSetupforOracleInstallonLinux

FastSetupforOracleInstallonLinux

时间:2021-07-01 10:21:17 帮助过:35人阅读

Oracle数据库教程,Fast Setup for Oracle Install on Linux

该脚本适用于与单实例或RAC环境;

在服务器上任意位置编辑一个文件,填入以下内容:

执行脚本:sh your_filename

then ,everything is OK,come baby let's go!

#!/bin/bash
# file: Oracle-11g-presetup.sh
# description: Oracle 11g Server install prepare script.

echo "Creat Oracle Group and User"
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
mkdir -p /u01/app/crs_base
mkdir -p /u01/app/crs_home
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R root:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chown -R grid:oinstall /u01/app/crs*
chmod -R 775 /u01
# chmod 660 /dev/dm*
passwd oracle<oracle
oracle
EOF
passwd grid<oracle
oracle
EOF

echo "Update System Control Config"
grep -v shmmax /etc/sysctl.conf|grep -v shmall >/etc/sysctl.tmp
mv /etc/sysctl.conf /etc/sysctl.conf.org
mv /etc/sysctl.tmp /etc/sysctl.conf
cat >> /etc/sysctl.conf <

# Oracle Server
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608
kernel.shmmax = 4294967296
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
END

# hot update system control config
sysctl -p

echo "Update system limits File"
cat >>/etc/security/limits.conf<grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
END

echo "Create Grid SetEnv Script"
ENVFILE1=/home/grid/setenv
cat > $ENVFILE1 <# Oracle 11g Grid users Env settings
umask 0022
export ORACLE_SID=+ASM #base your config to revise
export ORACLE_BASE=/u01/app/crs_base
export ORACLE_HOME=/u01/app/crs_home
export PATH=\$ORACLE_HOME/bin:\$PATH:/usr/local/bin/:.
export NLS_LANG='SIMPLIFIED CHINESE_CHINA.ZHS16GBK'
export JAVA_HOME=/usr/local/java
#/usr/local/bin/bash
if [ -t 0 ]; then
stty intr ^C
fi
END

chmod 777 $ENVFILE1

cat >> /home/grid/.bash_profile <# Load Oracle 11g Env
. $ENVFILE1
END

echo "Create Oracle SetEnv Script"
ENVFILE2=/home/oracle/setenv
cat > $ENVFILE2 <# Oracle 11g Oracle users Env settings
umask 0022
#export PS1="`/bin/hostname`-> "
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1
export GRID_HOME=/u01/app/crs_home
export ORACLE_OWNER=oracle
export ORACLE_SID=alex #base on your config to revise
export PATH=\$PATH:\$ORACLE_HOME/bin:\$GRID_HOME/bin:/sbin:/usr/sbin:/bin:/usr/local/bin:.
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:\$ORACLE_HOME/rdbms/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib:\$ORACLE_HOME/network/jlib
#export NLS_LANG=american_america.ZHS16GBK
export ORACLE_PATH=/home/oracle
export NLS_LANG='SIMPLIFIED CHINESE_CHINA.ZHS16GBK'
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
#For the Bourne, Bash, or Korn shell, add lines similar to the following to the /etc/profile file:

if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
END

chmod 777 $ENVFILE2

cat >> /root/.bash_profile <# Load Oracle 11g Env
. $ENVFILE2
END

cat >> /home/oracle/.bash_profile <# Load Oracle 11g Env
. $ENVFILE2
END

更多Oracle相关信息见Oracle 专题页面 ?tid=12

linux

人气教程排行