在使用Oracle Universal Installer(OUI)在UNIX平台上安装Oracle软件的快结束的时候会提示要执行orainstRoot.sh脚本。执行这个脚本目的是什么呢?以Linux平台的10g版本Oracle为例一起探索一下。1.orainstRoot.sh脚本内容[root@secdb ~]# ls -l /oracle/oraInventory/orainstRoot.sh
-rwxrwx--- 1 oracle oinstall 1614 Dec 21 2010 /oracle/oraInventory/orainstRoot.sh
[root@secdb ~]# cat /oracle/oraInventory/orainstRoot.sh
#!/bin/sh
AWK=/bin/awk
CHMOD=/bin/chmod
CHGRP=/bin/chgrp
CP=/bin/cp
ECHO=/bin/echo
MKDIR=/bin/mkdir
RUID=`/usr/bin/id $AWK -F\( '{print $2}' $AWK -F\) '{print $1}'`
if [ ${RUID} != "root" ];then
$ECHO "This script. must be executed as root"
exit 1
fi
if [ -d "/etc" ]; then
$CHMOD 755 /etc;
else
$MKDIR -p /etc;
fi
if [ -f "/oracle/oraInventory/oraInst.loc" ]; then
$CP /oracle/oraInventory/oraInst.loc /etc/oraInst.loc;
$CHMOD 644 /etc/oraInst.loc
else
INVPTR=/etc/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.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
";
$CHMOD -R g+rw,o-rwx /oracle/oraInventory;
if [ $? != 0 ]; then
$ECHO "OUI-35086:WARNING: chmod of /oracle/oraInventory
Adding read,write permissions for group.
,Removing read,write,execute permissions for world.
failed!";
fi
$ECHO "Changing groupname of /oracle/oraInventory to oinstall.";
$CHGRP -R 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."
从注释上可以得出脚本的功能描述。
# Create the software inventory location pointer file
# Create the inventory directory if it doesn't exist
因此orainstRoot.sh脚本作用就是创建Oracle软件安装清单的指向文件。
2.指向文件内容
[root@secdb ~]# cat /etc/oraInst.loc
inventory_loc=/oracle/oraInventory
inst_group=oinstall
此文件给出了Oracle软件安装清单目录和属组的名字。
--转自