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
更多精彩內容:http://www.bianceng.cn/database/Oracle/
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 <nodenumber>: <nodename> <private interconnect name> <hostname>
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 CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
node2
CSS is inactive on these nodes.
node1
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.
從輸出我們可以看出,該指令碼主要執行crs的配置,格式化ocr disk,更新/etc/inittab檔案,啟動css進程,在/var/opt/oracle/建立了ocr.loc檔案及,scls_scr,oprocd檔案夾。
2.2 查看crs進程及/etc/inittab檔案可以看出節點的變化。
root@node2 # ps -ef|grep crs|grep –v grep
oracle 18212 18211 0 14:47:28 0:00 /oracle/crs/bin/ocssd.bin
oracle 18191 18180 0 14:47:28 0:00 /oracle/crs/bin/oclsmon.bin
oracle 17886 1 0 14:47:27 0:00 /oracle/crs/bin/evmd.bin
oracle 18180 18092 0 14:47:28 0:00 /bin/sh -c cd /oracle/crs/log/node2/cssd/oclsmon; ulimit -c unlimited; /ora