酱油DBA奉献 Oracle 11gR2 RAC on linux 集成脚本化安装(三)
作为一个甲方酱油DBA,怎么可能不会搭建RAC?下面讲讲甲方酱油DBA是怎么脚本化安装RAC的?(本人已有10+套RAC搭建经验,AIX,HP-UNIX,LINUX,如有问题欢迎咨询)
本文用途:Linux平台下RAC集成脚本化安装。
网上也有形形色色的脚本化安装,有一些是问题的。本文把有问题的部分已经去除,现已安全使用。(仅限我的生产环境,其余朋友的生产环境慎用,如出现问题概不负责任)。
本文精华:“脚本化”三字概括,希望对酱油的DBA们有用
酱油DBA奉献ORACLE数据库监控健康脚本(一)
http://www.itpub.net/thread-1841912-1-1.html
酱油DBA奉献expdp,impdp多用户迁移数据(二)
http://www.itpub.net/thread-1868059-1-1.html
酱油DBA奉献 Oracle 11gR2 RAC on linux 集成脚本化安装(三)
http://www.itpub.net/thread-1900973-1-1.html
环境:
操作系统:redhat 6.2 64bit
数据库:rac 11.2.0.4.0
存储:EMC VNX5700
11gR2 RAC on linux 集成脚本化安装
1.基本环境脚本安装
cat dou.sh =>为了收集dou.1sh脚本日志
sh dou1.sh >dou.log
cat dou1.sh =>脚本如下:
echo "###Information Collection###"
##############################################
#Information Collection #
##############################################
echo "###redhat version###"
cat /etc/redhat-release
echo "###os memory###"
cat /proc/meminfo | grep MemTotal
echo "###os swap###"
cat /proc/meminfo | grep SwapTotal
echo "###os filesystem###"
df -h
echo "###os cpu numbers###"
cat /proc/cpuinfo |grep "processor"|wc -l
echo "###os cpu cores###"
cat /proc/cpuinfo |grep "cores"|uniq
echo "###create group and user###"
##############################################
#create group and user #
##############################################
/usr/sbin/groupadd -g 1000 oinstall
/usr/sbin/groupadd -g 1020 asmadmin
/usr/sbin/groupadd -g 1021 asmdba
/usr/sbin/groupadd -g 1022 asmoper
/usr/sbin/groupadd -g 1031 dba
/usr/sbin/groupadd -g 1032 oper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
useradd -u 1101 -g oinstall -G dba,oper,asmdba oracle
echo "###create /etc/oraInst.loc###"
##############################################
#create /etc/oraInst.loc #
##############################################
echo "inventory_loc=/oracle/app/oracle/oraInventory" >>/etc/oraInst.loc
echo "inst_group=oinstall" >>/etc/oraInst.loc
echo "###create directory and Privilege###"
##############################################
#create directory and Privilege #
##############################################
mkdir -p /oracle/app/11.2.0/grid
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/oracle/oraInventory
chown grid:oinstall /oracle/app/11.2.0/grid
chown grid:oinstall /oracle/app/grid
chmod -R 775 /oracle/
chown -R grid:oinstall /oracle
chown oracle:oinstall /oracle/app/oracle
echo "###LINUX optimize parameters####"
##############################################
#modify sysctl.conf | memory=64G #
##############################################
cat >> /etc/sysctl.conf <<done
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6553600
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
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmmax = 34359738368
kernel.shmall = 16777216
done
sleep 1
sysctl -p
sleep 1
###############################################
#modify /etc/security/limits.conf #
###############################################
cat >> /etc/security/limits.conf << done
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
done
sleep 1
################################################
#modify /etc/profile #
################################################
cat >> /etc/profile <<done
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
done
sleep 1
################################################
#modify /etc/pam.d/login #
################################################
echo "session required pam_limits.so">>/etc/pam.d/login
sleep 1
echo "###oracle environment variable ###"
################################################
# setting user oracle env #
################################################
cat >> /home/oracle/.bash_profile <<done
ORACLE_SID=doudoudb1; export ORACLE_SID
ORACLE_UNQNAME=doudoudb; export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_PATH=/oracle/app/common/oracle/sql; export ORACLE_PATH
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=american_america.ZHS16GBK ; export NLS_LANG
TNS_ADMIN=\$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=\$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:\${JAVA_HOME}/bin:\${PATH}:\$HOME/bin:\$ORACLE_HOME/bin
PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=\${PATH}:/oracle/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=\$ORACLE_HOME/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=\$ORACLE_HOME/JRE
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
done
done
sleep 1
echo "###grid environment variable ###"
###############################################
#setting user grid env #
###############################################
cat >> /home/grid/.bash_profile <<done
ORACLE_SID=+ASM1; export ORACLE_SID
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/oracle/app/grid; export ORACLE_BASE
ORACLE_HOME=/oracle/app/11.2.0/grid; export ORACLE_HOME
ORACLE_PATH=/oracle/app/oracle/common/oracle/sql; export ORACLE_PATH
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=american_america.ZHS16GBK ; export NLS_LANG
TNS_ADMIN=\$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=\$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:\${JAVA_HOME}/bin:\${PATH}:\$HOME/bin:\$ORACLE_HOME/bin
PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=\${PATH}:/oracle/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=\$ORACLE_HOME/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=\$ORACLE_HOME/JRE
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
done
sleep 1
#####以上为脚本内容########
2.脚本化后需要手工处理的一部分工作
###############################################
#System package collection and installation #
###############################################
检查所需系统包
for i in binutils compat-libcap1 compat-libstdc++-33 \
gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ \
libstdc++-devel libaio libaio-devel make sysstat unixODBC-devel unixODBC
do
rpm -q $i &>/dev/null || F="$F $i"
done ;echo $F;unset F
YUM安装所需包
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-devel unixODBC
###############################################
#modity oracle and grid password #
###############################################
passwd oracle
passwd grid
###############################################
#udev绑定LUN #
###############################################
酱油DBA奉献 Oracle 11gR2 RAC on linux 集成脚本化安装(三)
作为一个甲方酱油DBA,怎么可能不会搭建RAC?下面讲讲甲方酱油DBA是怎么脚本化安装RAC的?(本人已有10+套RAC搭建经验,AIX,HP-UNIX,LINUX,如有问题欢迎咨询)
本文用途:Linux平台下RAC集成脚本化安装。
网上也有形形色色的脚本化安装,有一些是问题的。本文把有问题的部分已经去除,现已安全使用。(仅限我的生产环境,其余朋友的生产环境慎用,如出现问题概不负责任)。
本文精华:“脚本化”三字概括,希望对酱油的DBA们有用
酱油DBA奉献ORACLE数据库监控健康脚本(一)
http://www.itpub.net/thread-1841912-1-1.html
酱油DBA奉献expdp,impdp多用户迁移数据(二)
http://www.itpub.net/thread-1868059-1-1.html
环境:
操作系统:redhat 6.2 64bit
数据库:rac 11.2.0.4.0
存储:EMC VNX5700
11gR2 RAC on linux 集成脚本化安装
1.基本环境脚本安装
cat dou.sh =>为了收集dou.1sh脚本日志
sh dou1.sh >dou.log
cat dou1.sh =>脚本如下:
echo "###Information Collection###"
##############################################
#Information Collection #
##############################################
echo "###redhat version###"
cat /etc/redhat-release
echo "###os memory###"
cat /proc/meminfo | grep MemTotal
echo "###os swap###"
cat /proc/meminfo | grep SwapTotal
echo "###os filesystem###"
df -h
echo "###os cpu numbers###"
cat /proc/cpuinfo |grep "processor"|wc -l
echo "###os cpu cores###"
cat /proc/cpuinfo |grep "cores"|uniq
echo "###create group and user###"
##############################################
#create group and user #
##############################################
/usr/sbin/groupadd -g 1000 oinstall
/usr/sbin/groupadd -g 1020 asmadmin
/usr/sbin/groupadd -g 1021 asmdba
/usr/sbin/groupadd -g 1022 asmoper
/usr/sbin/groupadd -g 1031 dba
/usr/sbin/groupadd -g 1032 oper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
useradd -u 1101 -g oinstall -G dba,oper,asmdba oracle
echo "###create /etc/oraInst.loc###"
##############################################
#create /etc/oraInst.loc #
##############################################
echo "inventory_loc=/oracle/app/oracle/oraInventory" >>/etc/oraInst.loc
echo "inst_group=oinstall" >>/etc/oraInst.loc
echo "###create directory and Privilege###"
##############################################
#create directory and Privilege #
##############################################
mkdir -p /oracle/app/11.2.0/grid
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/oracle/oraInventory
chown grid:oinstall /oracle/app/11.2.0/grid
chown grid:oinstall /oracle/app/grid
chmod -R 775 /oracle/
chown -R grid:oinstall /oracle
chown oracle:oinstall /oracle/app/oracle
echo "###LINUX optimize parameters####"
##############################################
#modify sysctl.conf | memory=64G #
##############################################
cat >> /etc/sysctl.conf <<done
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6553600
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
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmmax = 34359738368
kernel.shmall = 16777216
done
sleep 1
sysctl -p
sleep 1
###############################################
#modify /etc/security/limits.conf #
###############################################
cat >> /etc/security/limits.conf << done
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
done
sleep 1
################################################
#modify /etc/profile #
################################################
cat >> /etc/profile <<done
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
done
sleep 1
################################################
#modify /etc/pam.d/login #
################################################
echo "session required pam_limits.so">>/etc/pam.d/login
sleep 1
echo "###oracle environment variable ###"
################################################
# setting user oracle env #
################################################
cat >> /home/oracle/.bash_profile <<done
ORACLE_SID=doudoudb1; export ORACLE_SID
ORACLE_UNQNAME=doudoudb; export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_PATH=/oracle/app/common/oracle/sql; export ORACLE_PATH
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=american_america.ZHS16GBK ; export NLS_LANG
TNS_ADMIN=\$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=\$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:\${JAVA_HOME}/bin:\${PATH}:\$HOME/bin:\$ORACLE_HOME/bin
PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=\${PATH}:/oracle/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=\$ORACLE_HOME/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=\$ORACLE_HOME/JRE
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
done
done
sleep 1
echo "###grid environment variable ###"
###############################################
#setting user grid env #
###############################################
cat >> /home/grid/.bash_profile <<done
ORACLE_SID=+ASM1; export ORACLE_SID
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/oracle/app/grid; export ORACLE_BASE
ORACLE_HOME=/oracle/app/11.2.0/grid; export ORACLE_HOME
ORACLE_PATH=/oracle/app/oracle/common/oracle/sql; export ORACLE_PATH
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=american_america.ZHS16GBK ; export NLS_LANG
TNS_ADMIN=\$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=\$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:\${JAVA_HOME}/bin:\${PATH}:\$HOME/bin:\$ORACLE_HOME/bin
PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=\${PATH}:/oracle/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=\$ORACLE_HOME/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=\$ORACLE_HOME/JRE
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
done
sleep 1
#####以上为脚本内容########
2.脚本化后需要手工处理的一部分工作
###############################################
#System package collection and installation #
###############################################
检查所需系统包
for i in binutils compat-libcap1 compat-libstdc++-33 \
gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ \
libstdc++-devel libaio libaio-devel make sysstat unixODBC-devel unixODBC
do
rpm -q $i &>/dev/null || F="$F $i"
done ;echo $F;unset F
YUM安装所需包
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-devel unixODBC
###############################################
#modity oracle and grid password #
###############################################
passwd oracle
passwd grid
###############################################
#udev绑定LUN #
###############################################
for i in emcpowera emcpowerb emcpowerc emcpowerd emcpowere emcpowerf ;
do
echo "KERNEL==\"emcpower*\", SUBSYSTEM==\"block\", PROGRAM==\"/sbin/scsi_id -g -u -d --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id -g -u -d --whitelisted --replace-whitespace --device=/dev/$i`\", NAME=\"asm-$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。