您的位置:首页 > 数据库 > Oracle

Oracle安装需要脚本orainstRoot.sh

2015-06-30 23:32 525 查看
# 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."
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: