安装oracle 10g RAC执行的几个脚本说明

时间:2022-08-22 03:57:11

1,/u01/app/oracle/oraInventory/orainstRoot.sh 脚本 

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

从上面的脚步中可以看出,这个脚本的作用是/etc/oraInst.loc文件,并修改/etc和/u01/app/oracle/oraInventory 的权限

 

2./u01/crs1020/root.sh 脚步

脚本如下:

#!/bin/sh
/u01/crs1020/install/rootinstall
/u01/crs1020/install/rootconfig

调用上面的两个脚本

/u01/crs1020/install/rootinstall 如下

#!/bin/sh
#
# rootinstall.sbs for CRS installs
#
#    This is run once per CRS_HOME during the install.  This install specific
#    root script sets file ownerships, groups, and permissions on 
#    the files or directories that are to be owned by root user.
#
SILENT=false
CRS_ORACLE_HOME=/u01/crs1020
CRS_ORACLE_OWNER=oracle
CRS_DBA_GROUP=oinstall

if [ -z "$CHOWN" ]; then CHOWN=/bin/chown; fi
if [ -z "$CHGRP" ]; then CHGRP=/bin/chgrp; fi
if [ -z "$CHMOD" ]; then CHMOD=/bin/chmod; fi
if [ -z "$ECHO" ]; then ECHO=/bin/echo; fi
if [ -z "$AWK" ]; then AWK=/bin/awk; fi
if [ -z "$LS" ]; then LS=/bin/ls; fi
if [ -z "$ID" ]; then ID=/usr/bin/id; fi
if [ -z "$MKDIRP" ]; then MKDIRP="/bin/mkdir -p"; fi

usage()
{
   printf "Usage:"
   printf "$0 [-silent]\n"
   printf "   [-crshome <Oracle CRS home path>]\n"
   printf "   [-crsuser <Name of the user installing Oracle CRS>]\n"
   printf "   [-crsgroup <Name of the user-group installing Oracle CRS>]\n"
}

validateInput()
{
   ##validates if any value is assigned to the script variables
   valid=`$ECHO $1 | $AWK '/^%/ { print "false"; }'`
   if [ "$valid" = "false" ];
   then
      $ECHO "No value set for the CRS parameter $2. Use parameter file to set values";
      usage;
      return 1;
   fi

   return 0;
}

# This script is intended to be run by root.

RUID=`$ID|$AWK -F\( '{print $2}'|$AWK -F\) '{print $1}'`
if [ ${RUID} != "root" ];then
  $ECHO "You must be logged in as root to run $0."
  $ECHO "Log in as root and restart $0 execution."
  exit 1
fi

UNAME=/bin/uname
PLATFORM=`$UNAME`

case $PLATFORM in
Linux) DIRNAME=/usr/bin/dirname
       ;;
HP-UX) DIRNAME=/bin/dirname
       ;;
SunOS) DIRNAME=/bin/dirname
       ;;
AIX)   DIRNAME=/bin/dirname
       ;;
OSF1)  DIRNAME=/usr/bin/dirname
       ;;
*)     DIRNAME=/bin/dirname
       ;;
esac

USER_ARGS=$*

while [ $# -gt 0 ];
do
  if [ $1 = "-silent" ]; then
      SILENT=1;
  elif [ $1 = "-crshome" ]; then
    if [ $# -ge 2 ]; then
      CRS_ORACLE_HOME=$2;
      shift;
    else
      usage;
      exit 2
    fi
  elif [ $1 = "-crsuser" ]; then
       if [ $# -ge 2 ]; then
         CRS_ORACLE_OWNER=$2;
         shift;
       else
         usage;
         exit 2
       fi
  elif [ $1 = "-crsgroup" ]; then
       if [ $# -ge 2 ]; then
         CRS_DBA_GROUP=$2;
         shift;
       else
         usage;
         exit 2
       fi
  else
       usage;
       exit 2 
  fi
  shift;
done

validateInput $CRS_ORACLE_HOME "CRS_ORACLE_HOME" || { $ECHO $?; exit 1; }
validateInput $CRS_ORACLE_OWNER "CRS_ORACLE_OWNER" || { $ECHO $?; exit 1; }
validateInput $CRS_DBA_GROUP "CRS_DBA_GROUP" || { $ECHO $?; exit 1; }

ORA_CRS_HOME=$CRS_ORACLE_HOME
export ORA_CRS_HOME
CH=$ORA_CRS_HOME

export CRS_ORACLE_HOME

# set ownership to root, but give execute permissions to all

$CHOWN root $CH/bin/crs* 
$CHMOD 555  $CH/bin/crs* 

# only owner(root) should ever invoke crsd

$CHMOD 744  $CH/bin/crsd

if [ ! -d $CH/crs/init ]; then
   $MKDIRP $CH/crs/init
fi

$CHOWN root $CH
$CHMOD 755 $CH 

for d in bin crs crs/init crs/profile crs/script crs/template crs/auth
do
    $CHOWN root $CH/$d 
    $CHMOD 755 $CH/$d 
done

# These are writeable by all
for d in crs/public
do
    $CHOWN $CRS_ORACLE_OWNER $CH/$d 
    $CHMOD 777 $CH/$d 
done

for d in evm evm/init
do
    $CHMOD 750 $CH/$d 
done

for d in css css/init css/log css/auth
do
    $CHMOD 711 $CH/$d 
done

# check directories above $CH are owned by root

d=$CH
while [ "$d" != "/" ]
do
    d=`$DIRNAME $d`
    set -$- `$LS -ld $d`
    case $3 in
    root)   ;;      # ok
    *)      $ECHO "WARNING: directory '$d' is not owned by root";;
    esac
done

主要是对CRS需要的一些目录权限进行配置

/u01/crs1020/install/rootconfig这个脚本主要是对CRS进行配置,使CRS服务在服务器重启时自动启动,加入/etc/inittab ,格式化Voting disk等