Tuesday, 15 January 2013

Importance of orainstRoot.sh


[oracle@DBBACKUPSERVER oraInventory]$ cat orainstRoot.sh
#!/bin/sh
if [ -d "/etc" ]; then
chmod 755 /etc;
fi
if [ -f "/home/oracle/10.2.0/product/oraInventory/oraInst.loc" ]; then
cp /home/oracle/10.2.0/product/oraInventory/oraInst.loc /etc/oraInst.loc;
else
INVPTR=/etc/oraInst.loc
INVLOC=/home/oracle/10.2.0/product/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 /home/oracle/10.2.0/product/oraInventory to 770.";
chmod -R 770 /home/oracle/10.2.0/product/oraInventory;
if [ $? != 0 ]; then
 echo "OUI-35086:WARNING: chmod of /home/oracle/10.2.0/product/oraInventory to 770 failed!";
fi
echo "Changing groupname of /home/oracle/10.2.0/product/oraInventory to oinstall.";
chgrp oinstall /home/oracle/10.2.0/product/oraInventory;
if [ $? != 0 ]; then
 echo "OUI-10057:WARNING: chgrp of /home/oracle/10.2.0/product/oraInventory to oinstall failed!";
fi
echo "The execution of the script is complete"

No comments:

Post a Comment