设为首页 加入收藏

TOP

重新发现Oracle太美之root.sh(一)
2015-07-24 10:35:08 来源: 作者: 【 】 浏览:6
Tags:重新 发现 Oracle root.sh
如果你执行下以下命令基本上会在Oracle软件目录下会发现两个root.sh的脚本
[oracle@rh64 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的主要作用。
[oracle@rh64 ~]$ 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 "$@"
. /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
[oracle@rh64 ~]$
可以看到上面脚本里面包含了6个小的脚本,我们一一来分析下看看这个root.sh里面的脚本都是干啥的。

1.第一个脚本
[oracle@rh64 ~]$ 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_SIL
首页 上一页 1 2 3 4 5 6 下一页 尾页 1/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇oracle数据库开发面试题 下一篇oracle存储过程+游标处理select数..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·TCP/UDP协议_百度百科 (2025-12-26 12:20:11)
·什么是TCP和UDP协议 (2025-12-26 12:20:09)
·TCP和UDP详解 (非常 (2025-12-26 12:20:06)
·Python 教程 - W3Sch (2025-12-26 12:00:51)
·Python基础教程,Pyt (2025-12-26 12:00:48)