日期:2014-05-16  浏览次数:20504 次

RAC安装时需要执行4个脚本及意义

RAC安装时需要执行4个脚本

1) $ORACLE_BASE/oraInventory/orainstRoot.sh (clusterware 结束时执行)

2) $CRS_HOME/root.sh (clusterware 结束时执行)

3) $CRS_HOME/bin/vipca.sh(该脚本是在第二个节点执行$CRS_HOME/root.sh时被自动调用)

4) $ORACLE_HOME/root.sh (安装完数据库以后执行)

 

1. orainstRoot.sh 脚本

1.1 orainstRoot.sh 脚本执行过程

root@node2 #/oracle/oraInventory/orainstRoot.sh 

Changing permissions of /oracle/oraInventory to 770.

Changing groupname of /oracle/oraInventory to oinstall.

The execution of the script is complete

 

1.2 orainstRoot.sh 脚本内容

root@node1 # more /oracle/oraInventory/orainstRoot.sh

#!/bin/sh

if [ ! -d "/var/opt/oracle" ]; then

mkdir -p /var/opt/oracle;

fi

if [ -d "/var/opt/oracle" ]; then

chmod 755 /var/opt/oracle;

fi

if [ -f "/oracle/oraInventory/oraInst.loc" ]; then

cp /oracle/oraInventory/oraInst.loc /var/opt/oracle/oraInst.loc;

chmod 644 /var/opt/oracle/oraInst.loc;

else

INVPTR=/var/opt/oracle/oraInst.loc

INVLOC=/oracle/oraInventory

GRP=oinstall

PTRDIR="`dirname $INVPTR`";

# Create the software inventory location pointer file

if [ ! -d "$PTRDIR" ]; then

 mkdir -p $PTRDIR;

fi

echo "Creating the Oracle inventory pointer file ($INVPTR)";

echo   inventory_loc=$INVLOC > $INVPTR

echo   inst_group=$GRP >> $INVPTR

chmod 644 $INVPTR

# Create the inventory directory if it doesn't exist

if [ ! -d "$INVLOC" ];then

 echo "Creating the Oracle inventory directory ($INVLOC)";

 mkdir -p $INVLOC;

fi

fi

echo "Changing permissions of /oracle/oraInventory to 770.";

chmod -R 770 /oracle/oraInventory;

if [ $? != 0 ]; then

 echo "OUI-35086:WARNING: chmod of /oracle/oraInventory to 770 failed!";

fi

echo "Changing groupname of /oracle/oraInventory to oinstall.";

chgrp oinstall /oracle/oraInventory;

if [ $? != 0 ]; then

 echo "OUI-10057:WARNING: chgrp of /oracle/oraInventory to oinstall failed!";

fi

echo "The execution of the script is complete"

 

从脚本我们可以看出,这个脚本主要是创建/var/opt/oracle目录(如果不存在的话),再在该目录下建oraInst.loc文件(该文件记录orainventory的位置和组)。并改变orainventory的属性。

 

root@node2 # ls –rlt /var/opt/oracle/

total 2

-rw-r--r--  1 root    root         55 Apr 2 14:42&n