⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 root.sh

📁 orale培训教材包括了所有的sql说明和实例
💻 SH
字号:
#!/bin/sh# the following commands need to run as root after installing # the OEM Agent. They take care of fresh installs as well as # in-place upgrades from earlier versions.RMF="/bin/rm -f" CHOWN="/bin/chown"CHMOD="/bin/chmod"TEST="/usr/bin/test"ECHO="/bin/echo"ORACLE_HOME=/ora8/m01/app/oracle/product/8.1.7ORACLE_OWNER=oracle# change owner and permissions of the dbsnmp executable $CHOWN root $ORACLE_HOME/bin/dbsnmp $CHMOD 6750 $ORACLE_HOME/bin/dbsnmp # remove all previously created log and trace files $RMF $ORACLE_HOME/network/trace/dbsnmp*.trc $RMF $ORACLE_HOME/network/trace/oratcl*.trc $RMF $ORACLE_HOME/network/log/dbsnmp*.log $RMF $ORACLE_HOME/network/log/nmiconf.log $RMF $ORACLE_HOME/bin/dbsnmp0$RMF $ORACLE_HOME/bin/oemevent0$RMF $ORACLE_HOME/bin/oratclsh0# remove previously created pkgIndex.tc file $RMF $ORACLE_HOME/network/agent/library/pkgIndex.tcl # remove previously created snmp_ro.ora file $RMF $ORACLE_HOME/network/admin/snmp_ro.ora $RMF $TNS_ADMIN/snmp_ro.ora # adjust owner of snmp_rw.ora if $TEST -f $ORACLE_HOME/network/admin/snmp_rw.ora then   $CHOWN $ORACLE_OWNER $ORACLE_HOME/network/admin/snmp_rw.ora   $CHMOD 660 $ORACLE_HOME/network/admin/snmp_rw.ora fi if $TEST -f $TNS_ADMIN/snmp_rw.ora then   $CHOWN $ORACLE_OWNER $TNS_ADMIN/snmp_rw.ora   $CHMOD 660 $TNS_ADMIN/snmp_rw.ora fi # adjust owner of the agent queues and other associated files $CHOWN $ORACLE_OWNER $ORACLE_HOME/network/agent/* $CHMOD 770 $ORACLE_HOME/network/agent/*$CHMOD 750 $ORACLE_HOME/network/agent/jobs$CHMOD 750 $ORACLE_HOME/network/agent/events$CHMOD 750 $ORACLE_HOME/network/agent/config$CHMOD 750 $ORACLE_HOME/network/agent/library$CHMOD 750 $ORACLE_HOME/network/agent/tcl$CHMOD 750 $ORACLE_HOME/network/agent/mibs$CHMOD 750 $ORACLE_HOME/network/agent/jobs$CHMOD 777 $ORACLE_HOME/network/agent/jobout  $ECHO "IMPORTANT NOTE: Please delete any log and trace files previously" $ECHO "                created by the Oracle Enterprise Manager Intelligent"$ECHO "                Agent. These files may be found in the directories"$ECHO "                you use for storing other Net8 log and trace files." $ECHO "                If such files exist, the OEM IA may not restart." #!/usr/bin/sh## $Header# $Copyright### root.sh## This script is intended to be run by root.  The script contains# all the product installation actions that require root privileges.## IMPORTANT NOTES - READ BEFORE RUNNING SCRIPT## (1) ORACLE_HOME, ORACLE_OWNER, and ORACLE_SID can be defined in user's#     environment to override default values defined in this script.## (2) The environment variable LBIN (defined within the script) points to#     the default local bin area.  Three executables will be moved there as#     part of this script execution.## (3) Define (if desired) LOG variable to name of log file.#AWK=/bin/awkCAT=/bin/catCHOWN=/bin/chownCHMOD=/bin/chmodCP=/bin/cpECHO=/bin/echoGREP=/bin/grepLBIN=/usr/local/binMKDIR=/bin/mkdirORATABLOC=/etcORATAB=${ORATABLOC}/oratabRM=/bin/rmSED=/usr/local/bin/sedTEE=/usr/bin/teeTMPORATB=/tmp/oratab$$TEST=/usr/bin/testRMF="/bin/rm -f"## If LOG is not set, then send output to /dev/null#if [ x${LOG} = x ]then  LOG=/dev/nullelse  $CP $LOG ${LOG}0 2>/dev/null  $ECHO "" > $LOGfi## Display abort message on interrupt.#trap '$ECHO "Oracle8 root.sh execution aborted!"|tee -a $LOG;exit' 1 2 3 15## Enter log message#$ECHO "Running Oracle8 root.sh script..."|tee -a $LOG## Default values set by Installer#ORACLE_SID_INST=ORACLE_HOME=/ora8/m01/app/oracle/product/8.1.7ORACLE_OWNER=oracle## If this value is set by the installer are empty# then use the corresponding environment variable#if [ x${ORACLE_SID_INST} = x ]then  ORACLE_SID=${ORACLE_SID}else  ORACLE_SID=${ORACLE_SID_INST}fi# # It's ok if ORACLE_SID is not set -- it means a database # was not created in this ORACLE_HOME#if [ x${ORACLE_SID} = x ]then  $ECHO "ORACLE_SID is not set."| $TEE -a $LOGfiRUID=`/usr/bin/id|$AWK -F\( '{print $2}'|$AWK -F\) '{print $1}'`if [ ${RUID} != "root" ];then  $ECHO "You must be logged in as root to run root.sh."| $TEE -a $LOG  $ECHO "Log in as root and restart root.sh execution."| $TEE -a $LOG  exit 1fi## Determine how to suppress newline with $ECHO command.#case ${N}$C in  "") if $ECHO "\c"| $GREP c >/dev/null 2>&1;then        N='-n'      else        C='\c'      fi;;esac#$ECHO "The following environment variables are set as:"| $TEE -a $LOG$ECHO "    ORACLE_OWNER= $ORACLE_OWNER"| $TEE -a $LOG$ECHO "    ORACLE_HOME=  $ORACLE_HOME"| $TEE -a $LOG$ECHO "    ORACLE_SID=   $ORACLE_SID"| $TEE -a $LOG## Get name of local bin directory#$ECHO ""$ECHO $N "Enter the full pathname of the local bin directory: $C"DEFLT=${LBIN}; . $ORACLE_HOME/install/utl/read.sh; LBIN=$RDVARif [ ! -d $LBIN ];then  $ECHO "Creating ${LBIN} directory..."| $TEE -a $LOG  $MKDIR -p ${LBIN} 2>&1| $TEE -a $LOG  $CHMOD 777 ${LBIN} 2>&1| $TEE -a $LOGfi## Make sure an oratab file exists on this system#if [ ! -s ${ORATAB} ];then  $ECHO "Creating ${ORATAB} file..."| $TEE -a $LOG  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 the Database Configuration Assistant when creating# a database.# 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:<N|Y>:## 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.##!fi$CHOWN $ORACLE_OWNER ${ORATAB}$CHMOD 664 ${ORATAB}## If an entry exists in $ORATAB for this $SID and this $ORACLE_HOME,# don't do anything.#FOUND=`$GREP "^${SID}:${ORACLE_HOME}:" ${ORATAB}`if [ -z "${FOUND}" ];then  #  # 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  #  # Only add oratab entry if ORACLE_SID = "".  Otherwise, Database  # Configuration Assistant will add the entry when the database  # is actually created.  #  if [ x${ORACLE_SID} = x ]then     $ECHO "Adding entry to ${ORATAB} file..."| $TEE -a $LOG  $CAT <<!>> ${ORATAB}*:$ORACLE_HOME:N!  else     $ECHO "Entry will be added to the ${ORATAB} file by"| $TEE -a $LOG     $ECHO "Database Configuration Assistant when a database is created"| $TEE -a $LOG  fi else  $ECHO "Entry already exists in the ${ORATAB} file for this"| $TEE -a $LOG  $ECHO "ORACLE_SID and ORACLE_HOME.  No changes made to file."| $TEE -a $LOGfi## Move files to LBIN, and set permissions#DBHOME=$ORACLE_HOME/bin/dbhomeORAENV=$ORACLE_HOME/bin/oraenvCORAENV=$ORACLE_HOME/bin/coraenvFILES="$DBHOME $ORAENV $CORAENV"for f in $FILES ; do  if [ -f $f ] ; then    $CHMOD 755 $f  2>&1 2>> $LOG    $CP $f $LBIN  2>&1 2>>  $LOG        $CHOWN $ORACLE_OWNER $LBIN/`$ECHO $f | $AWK -F/ '{print $NF}'` 2>&1 2>> $LOG  fidone## Change mode to remove group write permission on Oracle home#$CHMOD -R g-w $ORACLE_HOME$ECHO "Finished running generic part of root.sh script."| $TEE -a $LOG$ECHO "Now product-specific root actions will be performed."| $TEE -a $LOG# # This is the same section as oemagent rooadd.sh# This is added here only in case of Linux platform#if $TEST -f $ORACLE_HOME/bin/dbsnmpthen# change owner and permissions of the dbsnmp executable$CHOWN root $ORACLE_HOME/bin/dbsnmp$CHMOD 6750 $ORACLE_HOME/bin/dbsnmpfi# remove all previously created log and trace files$RMF $ORACLE_HOME/network/trace/dbsnmp*.trc$RMF $ORACLE_HOME/network/trace/oratcl*.trc$RMF $ORACLE_HOME/network/log/dbsnmp*.log$RMF $ORACLE_HOME/network/log/nmiconf.log$RMF $ORACLE_HOME/bin/dbsnmp0$RMF $ORACLE_HOME/bin/oemevent0$RMF $ORACLE_HOME/bin/oratclsh0# remove previously created pkgIndex.tc file$RMF $ORACLE_HOME/network/agent/library/pkgIndex.tcl# remove previously created snmp_ro.ora file$RMF $ORACLE_HOME/network/admin/snmp_ro.ora$RMF $TNS_ADMIN/snmp_ro.ora# adjust owner of snmp_rw.oraif $TEST -f $ORACLE_HOME/network/admin/snmp_rw.orathen  $CHOWN $ORACLE_OWNER $ORACLE_HOME/network/admin/snmp_rw.ora  $CHMOD 660 $ORACLE_HOME/network/admin/snmp_rw.orafiif $TEST -f $TNS_ADMIN/snmp_rw.orathen  $CHOWN $ORACLE_OWNER $TNS_ADMIN/snmp_rw.ora  $CHMOD 660 $TNS_ADMIN/snmp_rw.orafi# adjust owner of the agent queues and other associated filesif $TEST -d $ORACLE_HOME/network/agentthen  $CHOWN $ORACLE_OWNER $ORACLE_HOME/network/agent/*  $CHMOD 770 $ORACLE_HOME/network/agent/*  $CHMOD 750 $ORACLE_HOME/network/agent/jobs  $CHMOD 750 $ORACLE_HOME/network/agent/events  $CHMOD 750 $ORACLE_HOME/network/agent/config  $CHMOD 750 $ORACLE_HOME/network/agent/library  $CHMOD 750 $ORACLE_HOME/network/agent/tcl  $CHMOD 750 $ORACLE_HOME/network/agent/mibs  $CHMOD 750 $ORACLE_HOME/network/agent/jobs  $CHMOD 777 $ORACLE_HOME/network/agent/joboutfi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -