Oracle RAC安装时需要执行4个脚本及意义(一)

2014-11-24 18:10:04 · 作者: · 浏览: 0

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


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 oraInst.loc


root@node2 # more oraInst.loc


inventory_loc=/oracle/oraInventory


inst_group=oinstall



在另一个节点上运行该脚本


root@node1 #/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



2. Root.sh 脚本



2.1 root.sh 脚本执行过程


root@node2 #/oracle/crs/root.sh


WARNING: directory '/oracle' is not owned by root


Checking to see if Oracle CRS stack is already configured


Checking to see if any 9i GSD is up



Setting the permissions on OCR backup directory


Setting up NS directories


Oracle Cluster Registry configuration upgraded successfully


WARNING: directory '/oracle' is not owned by root


Successfully accumulated necessary OCR keys.


Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.


node :


node 0: node2 node2-priv node2


node 1: node1 node1-priv node1


Creating OCR keys for user 'root', privgrp 'root'..


Operation successful.


Now formatting voting device: /oracle/ocrcfg1


Format of 1 voting devices complete.


Startup will be queued to init within 30 seconds.


Adding daemons to inittab


Expecting the