hort_f\" have not changed. No need to overwrite."
OVERWRITE='n';
fi
else
OVERWRITE='y';
fi
if [ "$OVERWRITE" = "y" -o "$OVERWRITE" = "Y" ] ; then
$CP $f $LBIN 2>&1 2>> $LOG
$CHMOD 755 $lbin_f 2>&1 2>> $LOG
$CHOWN $ORACLE_OWNER $LBIN/`$ECHO $f | $AWK -F/ '{print $NF}'` 2>&1 2>> $LOG
$ECHO " Copying $short_f to $LBIN ..."
fi
fi
done
------>>>注意这几个权限为755,下面是对比下$ORACLE_HOME和/usr/local/bin下几个文件权限和宿主的区别
[oracle@rh64 bin]$ ls -ltr dbhome
-rwxr-xr-x 1 oracle oinstall 2415 Jan 1 2000 dbhome
[oracle@rh64 bin]$ ls -tlr coraenv
-rwxr-xr-x 1 oracle oinstall 5778 Jan 1 2000 coraenv
[oracle@rh64 bin]$ ls -ltr oraenv
-rwxr-xr-x 1 oracle oinstall 6183 Jan 1 2000 oraenv
[root@rh64 bin]# ls -ltr dbhome
-rwxr-xr-x 1 oracle root 2415 Oct 30 2013 dbhome
[root@rh64 bin]# ls -ltr oraenv
-rwxr-xr-x 1 oracle root 6183 Oct 30 2013 oraenv
[root@rh64 bin]# ls -ltr coraenv
-rwxr-xr-x 1 oracle root 5778 Oct 30 2013 coraenv
------->>>>看到了吗?权限都是755,但是/usr/local/bin的拥有者为oracle:root,如果不慎丢失需要手工拷过来的时候记得需要改成755,oracle:root
else
$ECHO ""
$ECHO "Warning: $LBIN is read only. No files will be copied."
fi
$ECHO ""
#
# Make sure an oratab file exists on this system
#
# Variable to determine whether oratab is new or not; default is true
NEW="true"
if [ ! -s ${ORATAB} ];then
$ECHO ""
$ECHO "Creating ${ORATAB} file..."
if [ ! -d ${ORATABLOC} ];then
$MKDIR -p ${ORATABLOC}
fi
$CAT <> ${ORATAB}
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# \$ORACLE_SID:\$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same \$ORACLE_SID are not allowed.
#
#
!
else
# Oratab file exists; this is not a new installation on this system.
# We check if temporary install/oratab exists, and then check if the entry
# in temporary install/oratab has been added to the oratab file.
# In case of patchset this is usually the case, and we don't want to reappend
# the same entry to oratab again.
if [ -f $ORACLE_HOME/install/oratab ]
then
TMP_ENTRY=`$GREP "${ORACLE_HOME}" $ORACLE_HOME/install/oratab`
FOUND=`$GREP "${TMP_ENTRY}" ${ORATAB}`
if [ -n "${FOUND}" ]
then
NEW="false"
fi
fi
fi
----->>>>注意,我们所有root.sh脚本执行的日志都会在$ORACLE_HOME/install/下面有的,以便我们进行错误定位
$CHOWN $ORACLE_OWNER:$OSDBA_GROUP ${ORATAB}
$CHMOD 664 ${ORATAB}
----->>>/etc/oratab的权限为664
#
# If there is an old entry with no sid and same oracle home,
# that entry will be marked as a comment.
#
FOUND_OLD=`$GREP "^*:${ORACLE_HOME}:" ${ORATAB}`
if [ -n "${FOUND_OLD}" ];then
$SED -e "s?^*:$ORACLE_HOME:?# *:$ORACLE_HOME:?" $ORATAB > $TMPORATB
$CAT $TMPORATB > $ORATAB
$RM -f $TMPORATB 2>/dev/null
fi
$ECHO "Entries will be added to the ${ORATAB} file as needed by"
$ECHO "Database Configuration Assistant when a database is created"
#
# Append the dbca temporary oratab entry to oratab
# In the case of ASM and RAC install, oratab is not yet created when root.sh
# is run, so we need to check for its existence before attempting to append |