Oracle 11g R2 RAC安裝前的系統環境搭建
在安裝Oracle 11g
RAC時有很多的前期準備工作要做,在多個節點上做大量繁瑣、重複的工作著實讓人無法忍受。而用指令碼代替手工操作無疑會使工作效率大大提高。本文是一個RAC環境搭建的shell指令碼,在每個節點上對紅色字型稍作更改,就可以用該指令碼做如下工作:安裝所需的軟體包,建立使用者,使用者環境變數的配置以及系統引數的配置等。
#!/bin/bash
#oracle RAC enviroment configure
#./oracinstall.sh
#software setup
software()
{
for software in binutils\
compat-libstdc++\
#!/bin/bash
#oracle RAC enviroment configure
#./oracinstall.sh
#software setup
software()
{
for software in 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\
sysstat\
unixODBC\
unixODBC-devel;do
rpm -qa|grep ${software} >/dev/null
if [ $? -ne 0 ];then
echo "${software} is not installed"
rpm -Uvh /cdrom/${software}-*
if [ $? -eq 0 ];then
echo "${software} installed successful"
fi
fi
echo "${software} has been installed"
done
}
#create user and group for grid infrastructure
grid()
{
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid
#grid登入密碼,可以根據實際情況設定
echo "gridpassword" |passwd --stdin grid
cat >>/home/grid/.bash_profile<
#ASM例項的sid,每個節點唯一
ORACLE_SID=+ASM1;export ORACLE_SID
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
ORACLE_PATH=/u01/app/oracle/common/oracle/sql; export ORACLE_PATH
SQLPATH=/u01/app/common/oracle/sql; export SQLPATH
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
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}:/u01/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
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
EOF
source /home/grid/.bash_profile
}
#create user and group for oracle
oracle()
{
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
#oracle使用者登入密碼,可以根據實際情況設定
echo "oraclepassword"|passwd --stdin oracle
cat >>/home/oracle/.bash_profile<
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
alias lsnrctl="rlwrap lsnrctl"
#oracle例項的sid,每個節點唯一
ORACLE_SID=racdb1; export ORACLE_SID
ORACLE_UNQNAME=racdb; export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_PATH=/u01/app/common/oracle/sql; export ORACLE_PATH
SQLPATH=/u01/app/common/oracle/sql; export SQLPATH
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
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}:/u01/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
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
EOF
source /home/oracle/.bash_profile
}
id nobody>/dev/null 2>&1
if [ $? -ne 0 ];then
useradd nobody
fi
#create home base for grid and oracle
homebase()
{
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
}
limit()
{
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
EOF
cat >>/etc/pam.d/login<
session
required
pam_limits.so
EOF
}
profile()
{
cat >> /etc/profile <
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
EOF
}
sys()
{
cat >/etc/sysctl.conf<
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
#4GB physical memory configure like this
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
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.aio-max-nr = 1048576
EOF
}
#==============
case ${1} in
software)
software
;;
grid)
grid
;;
oracle)
oracle
;;
homebase)
hoembase
;;
limit)
limit
;;
profile)
profile
;;
sys)
sys
;;
all)
software
grid
oracle
homebase
limit
profile
sys
;;
*)
exit 0
;;
esac
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\
sysstat\
unixODBC\
unixODBC-devel;do
rpm -qa|grep ${software} >/dev/null
if [ $? -ne 0 ];then
echo "${software} is not installed"
rpm -Uvh /cdrom/${software}-*
if [ $? -eq 0 ];then
echo "${software} installed successful"
fi
fi
echo "${software} has been installed"
done
}
#create user and group for grid infrastructure
grid()
{
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid
#grid登入密碼,可以根據實際情況設定
echo "gridpassword" |passwd --stdin grid
cat >>/home/grid/.bash_profile<
ORACLE_SID=+ASM1;export ORACLE_SID
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
ORACLE_PATH=/u01/app/oracle/common/oracle/sql; export ORACLE_PATH
SQLPATH=/u01/app/common/oracle/sql; export SQLPATH
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
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}:/u01/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
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
EOF
source /home/grid/.bash_profile
}
#create user and group for oracle
oracle()
{
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
#oracle使用者登入密碼,可以根據實際情況設定
echo "oraclepassword"|passwd --stdin oracle
cat >>/home/oracle/.bash_profile<
alias rman="rlwrap rman"
alias lsnrctl="rlwrap lsnrctl"
#oracle例項的sid,每個節點唯一
ORACLE_SID=racdb1; export ORACLE_SID
ORACLE_UNQNAME=racdb; export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_PATH=/u01/app/common/oracle/sql; export ORACLE_PATH
SQLPATH=/u01/app/common/oracle/sql; export SQLPATH
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
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}:/u01/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
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
EOF
source /home/oracle/.bash_profile
}
id nobody>/dev/null 2>&1
if [ $? -ne 0 ];then
useradd nobody
fi
#create home base for grid and oracle
homebase()
{
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
}
limit()
{
cat >>/etc/security/limits.conf<
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
EOF
cat >>/etc/pam.d/login<
EOF
}
profile()
{
cat >> /etc/profile <
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF
}
sys()
{
cat >/etc/sysctl.conf<
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
#4GB physical memory configure like this
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
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.aio-max-nr = 1048576
EOF
}
#==============
case ${1} in
software)
software
;;
grid)
grid
;;
oracle)
oracle
;;
homebase)
hoembase
;;
limit)
limit
;;
profile)
profile
;;
sys)
sys
;;
all)
software
grid
oracle
homebase
limit
profile
sys
;;
*)
exit 0
;;
esac
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27181165/viewspace-775874/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 通過ORACLE VM virtualbox環境安裝oracle 11G RAC(ASM)OracleASM
- oracle 11g RAC 安裝前準備指令碼Oracle指令碼
- Oracle 11G RAC叢集安裝(1)——安裝前的準備Oracle
- oracle 11G RAC的建立(VM虛擬環境)Oracle
- Oracle 11G RAC叢集安裝(3)——安裝OracleOracle
- Oracle 11G RAC叢集安裝(2)——安裝gridOracle
- Oracle:Redhat 7 + Oracle RAC 11g 安裝 bug 總結OracleRedhat
- Linux系統安裝ansiblle環境Linux
- ORACLE 12C RAC 生產環境搭建介紹Oracle
- NodeJS安裝與環境搭建NodeJS
- Oracle RAC 環境下的連線管理Oracle
- rhel7 安裝11g rac
- Mac系統Python開發環境的安裝MacPython開發環境
- Mac系統Go開發環境的安裝MacGo開發環境
- Linux系統環境搭建Linux
- Oracle 11g RAC安裝--基於openfiler儲存+多路徑+udev方式Oracledev
- Ubuntu系統-FFmpeg安裝及環境配置Ubuntu
- AIX 5.3/6.1環境下安裝Oracle 10gR2 RAC常見報錯AIOracle 10g
- Oracle 11G 安裝文件Oracle
- 麒麟系統開發筆記(五):製作安裝麒麟系統、物理機安裝麒麟系統搭建Qt開發環境筆記QT開發環境
- AD域環境的搭建 基於Server 2008 R2Server
- 【BUILD_ORACLE】Oracle 19c RAC搭建(五)DB軟體安裝UIOracle
- 【BUILD_ORACLE】Oracle 19c RAC搭建(四)Grid軟體安裝UIOracle
- oracle rac資料庫的安裝Oracle資料庫
- node環境搭建、npm及pnpm安裝NPM
- 龍芯+UOS系統下java環境安裝Java
- linux系統安裝jdk,配置環境變數LinuxJDK變數
- Oracle 12cR1 RAC叢集安裝(一)--環境準備Oracle
- 11G RAC+DG搭建
- nginx手動安裝基於類centos系統環境安裝NginxCentOS
- 蘋果系統安裝php環境的方法詳解蘋果PHP
- Oracle 11G 安裝 bbed 工具Oracle
- redhat7 搭建oracle 11g RAC 問題與處理RedhatOracle
- oracle 11g rac新增節點前之清除節點資訊Oracle
- 【BUILD_ORACLE】Oracle 19c RAC搭建(一)安裝資源規劃UIOracle
- 京東雲環境搭建oracle rac詳細部署梳理(可信的結果輸出)Oracle
- Oracle 11g RAC Silent Install For NFSOracleNFS
- 快速搭建 Linux(LNMP + Linux 安裝 + 環境配置)LinuxLNMP
- Ubuntu18.04安裝Selenium和環境搭建Ubuntu