ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 安装oracle rac 前期 脚本

安装oracle rac 前期 脚本

原创 Linux操作系统 作者:jisen_huang 时间:2012-07-25 16:51:21 0 删除 编辑

#!/bin/sh
echo -n "Enter 'Rac1ip':"
read Rac1ip
 echo "Rac1ip is $Rac1ip"

echo -n "Enter 'Rac2ip':"
read Rac2ip
 echo "Rac2ip is $Rac2ip"

echo -n "Enter 'Rac1Priv':"
read Rac1Priv
 echo "Rac1Priv is $Rac1Priv"

echo -n "Enter 'Rac2Priv':"
read Rac2Priv
 echo "Rac2Priv is $Rac2Priv"

echo -n "Enter 'Rac1Vip':"
read Rac1Vip
 echo "Rac1Vip is $Rac1Vip"

echo -n "Enter 'Rac2Vip':"
read Rac2Vip
 echo "Rac2Vip is $Rac2Vip"

echo -n "Enter 'Rac1Name':"
read Rac1Name
 echo "Rac1Name is $Rac1Name"

echo -n "Enter 'Rac2Name':"
read Rac2Name
 echo "Rac2Name is $Rac2Name"

echo -n "Enter 'OcrDisk':"
read OcrDisk
echo "OcrDisk is $OcrDisk"

echo -n "Enter 'VotingDisk':"
read VotingDisk
echo "VotingDisk is $VotingDisk"

ssh $Rac1ip copy /etc/hosts /etc/hosts.%U cat >> /etc/hosts <$Rac1ip   $Rac1Name
$Rac2ip   $Rac2Name
$Rac1Vip  $Rac1Name-vip
$Rac2Vip  $Rac2Name-vip
$Rac1Priv  $Rac1Name-priv
$Rac2Priv  $Rac2Name-priv
EOF

 

ssh $Rac1ip
groupadd -g 1001 oinstall
groupadd -g 1002 dba
useradd -u 1001 -m -g oinstall -G dba oracle
id oracle
a=oracle
echo oracle:$a|chpasswd

mkdir -p /u01/app/oracle
mkdir -p /u02/oradata/
mkdir -p /u02/oracrs
chown -R oracle:oinstall /u02 /u01
chmod -R 775 /u02 /u01


cat >> /etc/sysctl.conf <kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=3262144
net.core.wmem_max=3262144
EOF

cat >> /etc/security/limits.conf <oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <session required /lib/security/pam_limits.so
EOF

cat >> /etc/profile <if [ \$USER = "oracle" ]; then
 if [ \$SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
 umask 022
fi
EOF

cat >> /etc/csh.login <if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
EOF

cat >> /etc/rc.d/rc.local<modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF

cat >> /etc/udev/rules.d/60-raw.rules <ACTION=="add", KERNEL==" $OcrDisk", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="$VotingDisk ", RUN+="/bin/raw /dev/raw/raw2 %N"
KERNEL=="raw[1-9]", WNER="oracle", GROUP="oinstall", MODE="660"
KERNEL=="raw1[0-9]", WNER="oracle", GROUP="oinstall", MODE="660"
KERNEL=="raw20", WNER="oracle", GROUP="oinstall", MODE="660"
EOF

start_udev

cat >>/home/oracle/.bash_profile<unset USERNAME
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/10.2.0.1/crs
export ORA_CRS_HOME=\$ORACLE_BASE/product/10.2.0.1/crs
export ORA_DB_HOME=\$ORACLE_BASE/product/10.2.0.1/db
export ORACLE_SID=HASB
export PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin:\$ORA_CRS_HOME/bin:\$ORACLE_BASE/common/oracle/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export ORACLE_PATH=\$ORACLE_BASE/common/oracle/sql:\$ORACLE_HOME/rdbms/admin
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export ORA_NLS10=\$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=\$ORACLE_HOME/JRE
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask=022
EOF

ssh $Rac2ip copy /etc/hosts /etc/hosts.%U cat >> /etc/hosts <$Rac1ip   $Rac1Name
$Rac2ip   $Rac2Name
$Rac1Vip  $Rac1Name-vip
$Rac2Vip  $Rac2Name-vip
$Rac1Priv  $Rac1Name-priv
$Rac2Priv  $Rac2Name-priv
EOF


ssh $Rac2ip
groupadd -g 1001 oinstall
groupadd -g 1002 dba
useradd -u 1001 -m -g oinstall -G dba oracle
id oracle
a=oracle
echo oracle:$a|chpasswd

mkdir -p /u01/app/oracle
mkdir -p /u02/oradata/
mkdir -p /u02/oracrs
chown -R oracle:oinstall /u02 /u01
chmod -R 775 /u02 /u01


cat >> /etc/sysctl.conf <kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=3262144
net.core.wmem_max=3262144
EOF

cat >> /etc/security/limits.conf <oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <session required /lib/security/pam_limits.so
EOF

cat >> /etc/profile <if [ \$USER = "oracle" ]; then
 if [ \$SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
 umask 022
fi
EOF

cat >> /etc/csh.login <if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
EOF

cat >> /etc/rc.d/rc.local<modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF

cat >> /etc/rc.d/rc.local<modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF

cat >> /etc/udev/rules.d/60-raw.rules <ACTION=="add", KERNEL==" $OcrDisk", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="$VotingDisk ", RUN+="/bin/raw /dev/raw/raw2 %N"
KERNEL=="raw[1-9]", WNER="oracle", GROUP="oinstall", MODE="660"
KERNEL=="raw1[0-9]", WNER="oracle", GROUP="oinstall", MODE="660"
KERNEL=="raw20", WNER="oracle", GROUP="oinstall", MODE="660"
EOF

start_udev


cat >>/home/oracle/.bash_profile<unset USERNAME
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/10.2.0.1/crs
export ORA_CRS_HOME=\$ORACLE_BASE/product/10.2.0.1/crs
export ORA_DB_HOME=\$ORACLE_BASE/product/10.2.0.1/db
export ORACLE_SID=HASB
export PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin:\$ORA_CRS_HOME/bin:\$ORACLE_BASE/common/oracle/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export ORACLE_PATH=\$ORACLE_BASE/common/oracle/sql:\$ORACLE_HOME/rdbms/admin
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export ORA_NLS10=\$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=\$ORACLE_HOME/JRE
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask=022
EOF

 

ssh $Rac1ip
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
ssh $Rac2ip cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh $Rac2ip cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys $Rac2ip:~/.ssh/authorized_keys
 

ssh $Rac1Name date
ssh $Rac2Name date
ssh $Rac1Name-priv date
ssh $Rac2Name-priv date

 


 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26478664/viewspace-736626/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 安装oracle 脚本
下一篇: ORA-00257
请登录后发表评论 登录
全部评论

注册时间:2011-11-24

  • 博文量
    32
  • 访问量
    17785