又一次發現Oracle太美之root.sh

來源:互聯網
上載者:User

標籤:else   iat   can   ase   tracking   div   包括   date   require   

假設你運行下下面命令基本上會在Oracle軟體檔案夾下會發現兩個root.sh的指令碼
[[email protected] Templates]$ find /u01/ -name root.sh |xargs ls -ltr
-rwxrwx--- 1 oracle oinstall  10 May 14 02:37 /u01/app/db11g/product/11.2.0/dbhome_1/inventory/Templates/root.sh
-rwxr-x--- 1 oracle oinstall 512 May 14 02:47 /u01/app/db11g/product/11.2.0/dbhome_1/root.sh


第一個指令碼裡面沒啥東西。我們今天主要來研究下第二個root.sh是幹啥用的。也就是我們安裝軟體後須要執行的這個root.sh的主要作用。
[[email protected] ~]$ cat /u01/app/db11g/product/11.2.0/dbhome_1/root.sh
#!/bin/sh
. /u01/app/db11g/product/11.2.0/dbhome_1/install/utl/rootmacro.sh "[email protected]"
. /u01/app/db11g/product/11.2.0/dbhome_1/install/utl/rootinstall.sh
/u01/app/db11g/product/11.2.0/dbhome_1/install/unix/rootadd.sh


#
# Root Actions related to network
#
/u01/app/db11g/product/11.2.0/dbhome_1/network/install/sqlnet/setowner.sh 


#
# Invoke standalone rootadd_rdbms.sh
#
/u01/app/db11g/product/11.2.0/dbhome_1/rdbms/install/rootadd_rdbms.sh


/u01/app/db11g/product/11.2.0/dbhome_1/rdbms/install/rootadd_filemap.sh 
[[email protected] ~]$ 
能夠看到上面指令碼裡麵包括了6個小的指令碼,我們一一來分析下看看這個root.sh裡面的指令碼都是幹啥的。


1.第一個指令碼
[[email protected] ~]$ cat /u01/app/db11g/product/11.2.0/dbhome_1/install/utl/rootmacro.sh
#!/bin/sh
#
# $Id: rootmacro.sbs /st_buildtools_11.2.0/2 2012/11/06 02:43:45 rmallego Exp $
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 
#
# 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 and ORACLE_OWNER 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.
#
-------->>>上面明白說明執行指令碼之前ORACLE_HOME,ORACLE_OWNER一定要設定
AWK=/bin/awk
CAT=/bin/cat
CHGRP=/bin/chgrp
CHOWN=/bin/chown
CHMOD=/bin/chmod
CP=/bin/cp
DIFF=/usr/bin/diff
ECHO=echo
GREP=/bin/grep
LBIN=/usr/local/bin
MKDIR=/bin/mkdir
ORATABLOC=/etc
ORATAB=${ORATABLOC}/oratab
RM=/bin/rm
SED=/bin/sed
UNAME=/bin/uname
DATE=/bin/date
TEE=/usr/bin/tee
TMPORATB=/var/tmp/oratab$$


if [ `$UNAME` = "SunOS" ]
then
      GREP=/usr/xpg4/bin/grep
fi 


# Variable based on installation
OUI_SILENT=false


#
# Default values set by Installer
#


ORACLE_HOME=/u01/app/db11g/product/11.2.0/dbhome_1
ORACLE_OWNER=oracle
OSDBA_GROUP=oinstall
MAKE=/usr/bin/make


#
# conditional code execution starts. This set of code is invoked exactly once
# regardless of number of scripts that source rootmacro.sh
if [ "x$WAS_ROOTMACRO_CALL_MADE" = "x" ]; then
  WAS_ROOTMACRO_CALL_MADE=YES ; export WAS_ROOTMACRO_CALL_MADE
  LOG=${ORACLE_HOME}/install/root_`$UNAME -n`_`$DATE +%F_%H-%M-%S`.log ; export LOG


#
# Parse argument
#
  while [ $# -gt 0 ]
  do
    case $1 in
      -silent)  SILENT_F=1;;         # silent is set to true 
      -crshome) shift; CRSHOME=$1; export CRSHOME;;  # CRSHOME is set
      -bindir) shift; LBIN=$1; export LBIN;;
    esac;
    shift
  done


#
# If LOG is not set, then send output to /dev/null
#


  if [ "x${LOG}" = "x" -o "${LOG}" = "" ];then
    LOG=/dev/null
  else
    $CP $LOG ${LOG}0 2>/dev/null
    $ECHO "" > $LOG
  fi


#
# Silent variable is set based on :
# if OUI_SILENT is true or if SILEN

又一次發現Oracle太美之root.sh

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.