home *** CD-ROM | disk | FTP | other *** search
- :
-
- #
- # $Header: rdbms.in.pp,v 6.95 89/11/14 15:30:36 rafsarif Exp $ rdbms.in.pp
- #
-
- #
- # rdbms.install
- #
- # This is the installation script to install the ORACLE RDBMS on a
- # UNIX ORACLE system.
- #
- # It can be invoked by the master installation script, oracle.install,
- # or as a stand alone procedure.
- #
- # The master script, oracle.install, sets ORACLE_HOME,
- # and LOG before it runs this script.
- # If the script is run stand-alone, then these variables must be set and
- # exported before it is run.
- #
- # Default answers are shown in square brackets.
- #
-
- NETLIBNAME="nsl_s"
- PHYS_BLK_SIZE=2048
- VNDR_NETLIBS="-lnsl_s "
- CHOWN=/bin/chown
- MAKE=make
- ORACLE_LPPROG="/usr/bin/lp"
- ORACLE_PAGER="/usr/bin/more"
- ORACLE_LPSTAT="/usr/bin/lpstat"
-
- product=rdbms
- PRODUCT=RDBMS
- MKTG_NAME="ORACLE RDBMS"
-
- #
- # Setup the environment variables for the installation script.
- #
- . $ORACLE_HOME/install/setup.ins
-
- #
- # Protect bin directory
- #
- cd $ORACLE_HOME/bin
- chmod 755 .
-
- chmod 4751 oracle 2>/dev/null
- chmod 751 sqldba exp imp odl 2>/dev/null
-
- #
- # "install" user scripts
- #
- chmod 755 coraenv dbhome oerr oraenv >> $LOG 2>&1
-
- #
- # Protect dbs directory
- #
- cd $ORACLE_HOME/dbs
- chmod 755 . >> $LOG 2>&1
- for i in `ls $ORACLE_HOME/dbs/* `;
- do
- if [ -f $i ]; then
- chmod 644 $i;
- fi
- done
-
- chmod 444 $ORACLE_HOME/${product}/mesg/*
-
- #
- # Create rdbms/log directory for trace files.
- #
- if [ ! -d $ORACLE_HOME/rdbms/log ]; then
- mkdir $ORACLE_HOME/rdbms/log >> $LOG 2>&1
- fi
-
- #
- # Check if any database or log files corresponding to the same SID
- # already exist. If they do ask user if they want to continue since
- # the old data will be lost by recreating the database.
- # For 6.0.27, the default control file name has been changed from
- # control1{SID}.dbf to cntrl{SID}.dbf.
- #
- if [ "$UPDATE" = "Y" ] ; then
- if [ -f $ORACLE_HOME/dbs/control1${ORACLE_SID}.dbf \
- -a ! -f $ORACLE_HOME/dbs/cntrl${ORACLE_SID}.dbf ]; then
- echo "Please rename 'control1${ORACLE_SID}.dbf' to 'cntrl${ORACLE_SID}.dbf' for 6.0.27." | tee -a $LOG
- echo "Also modify the database startup parameter 'control_files' if necessary." | tee -a $LOG
- echo "Please refer to IUG for more information." | tee -a $LOG
- echo "Upgrade to 6.0.27 failed!" | tee -a $LOG
- echo "Exiting ORACLE RDBMS install." | tee -a $LOG
- exit 1
- fi
- else
-
- if [ -f $ORACLE_HOME/dbs/*${ORACLE_SID}.dbf ] ; then
-
- echo ""
- echo "The following database files were found in $ORACLE_HOME/dbs:" | tee -a $LOG
- ls $ORACLE_HOME/dbs/*${ORACLE_SID}.dbf | tee -a $LOG
- echo "Continuing with DEFAULT installation will overwrite these files." | tee -a $LOG
- echo $N "Okay to continue? $C" | tee -a $LOG
- DEFLT=N; . $INSTALL_HOME/read.sh; ANSWER=$RDVAR
- case $ANSWER in
- Y|y) ;;
- *) echo "Exiting ORACLE RDBMS install." | tee -a $LOG
- exit 0 ;;
- esac
- fi
- fi
-
- #
- # Check if a database is already running. If it is, then ask if install
- # should proceed?
- #
- if [ -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.dbf ] ; then
- echo ""
- echo ""
- echo "Database currently running." | tee -a $LOG
- echo $N "Okay to shutdown the database? $C" | tee -a $LOG
- DEFLT=N; . $INSTALL_HOME/read.sh; ANSWER=$RDVAR
- case $ANSWER in
- Y|y) echo "Shutting down current database..." | tee -a $LOG
- sqldba command=shutdown >> $LOG ;;
- *) echo "
- The database has to be brought down for $MKTG_NAME installation.
- You can shutdown the database and repeat the installation,
- or repeat the automated installation and answer Y to the above question.
- Exiting ORACLE RDBMS install." | tee -a $LOG
- exit 0 ;;
- esac
- fi
-
- #
- # Run the script under osh to raise the ulimit if osh has been installed
- # but not run.
- # The number compared to $LIMIT is taken from osh.c.
- #
-
- ULIMIT=`ulimit`
-
- if [ -x $ORACLE_HOME/bin/osh -a "$ULIMIT" -lt 2113674 ]; then
- $ORACLE_HOME/bin/osh $0
- exit 0
- fi
-
- #
- # Touch sysliblist. This assures that makefiles will find this file
- # even if no network driver was installed.
- #
- touch $ORACLE_HOME/rdbms/lib/sysliblist
-
- #
- # If executables are not going to be linked, check to make sure the dba group
- # in config.c is valid. If not the user will have the choice between relinking
- # or exiting and reseting the group id.
- #
- if [ "$LINK_PRODUCT" != "T" ] ; then
- DBA_GRP="`grep '#define SS_DBA_GRP' $ORACLE_HOME/rdbms/lib/config.c | \
- sed 's/#define SS_DBA_GRP \"//' | sed 's/\"$//'`"
-
- GID=`id| sed 's/.*gid=.*(//'| sed 's/)$//'`
- if [ "`echo $GID | grep $DBA_GRP`" = "" ] ; then
- echo ""
- echo "
- $DBA_GRP is the privileged group in $ORACLE_HOME/rdbms/lib/config.c,
- but is not your current group id. Your options are:
-
- 1 - Continue running $MKTG_NAME installation and relink the
- rdbms executables, with group id = $GID.
- 2 - Exit $MKTG_NAME installation, reset you group id, and repeat
- the installation." | tee -a $LOG
-
- echo $N "Please enter you option. $C" | tee -a $LOG
- DEFLT=2; . $INSTALL_HOME/read.sh; ANSWER=$RDVAR
- case $ANSWER in
- 1) LINK_PRODUCT="T" ;;
- *) echo "Exiting ORACLE RDBMS install..." | tee -a $LOG
- exit 0 ;;
- esac
- fi
- fi
-
- #
- # Determine gid for ORACLE DBA access and put it into config.c.
- #
- if [ "$LINK_PRODUCT" = "T" -o "$TPO_INSTALL" = "T" -o "$PLSQL_INSTALL" = "T" ]
- then
- GID=`grep "^$ORACLE_OWNER:" /etc/passwd 2>/dev/null| awk -F: '{print $4}'`
-
- # If GID is null, check if the system is yellow paged.
- if [ "$GID" = "" ] ; then
- GID=`sh ypmatch $ORACLE_OWNER passwd.byname 2>/dev/null | awk -F: '{print $4}'`
- fi
-
- GROUPD=`fgrep :$GID: /etc/group | awk -F: '{print $1}'` 2>> $LOG
-
- # If GROUPD is null check if yellow page is running
- if [ "$GROUPD" = "" ] ; then
- GROUPD=`sh ypmatch "$GID" group.bygid 2> /dev/null | awk -F: '{print $1}'`
- fi
- while : ; do
- echo ""
- echo ""
- echo $N "Enter the privileged group name for SQL*DBA. $C"
- DEFLT="$GROUPD"; . $INSTALL_HOME/read.sh; ANS=$RDVAR
- SAVE_ANS=`grep "^$ANS:" /etc/group`
- # Check the yellow pages.
- if [ "$SAVE_ANS" = "" ] ; then
- SAVE_ANS=`sh ypmatch "$ANS" group.byname 2> /dev/null`
- fi
- if [ "$SAVE_ANS" = "" ] ; then
- if [ "$ORACLE_DEFAULT" = "T" ] ; then
- echo ""
- echo "The default group name corresponding to group id $GID is not valid."
- echo "Please check /etc/passwd and /etc/group, and run the script again."
- exit 1
- else
- echo ""
- echo "$ANS is not a valid group. Please select again."
- continue
- fi
- fi
- case "$ANS" in
- "") GROUP=$GROUPD ; break ;;
- *) GROUP=$ANS ; break ;;
- esac
- done
-
- GID=`echo $SAVE_ANS | awk -F: '{print $3}'` 2>> $LOG
-
- echo ""
- echo "Setting ORACLE DBA access group to $GROUP ($GID)..." | tee -a $LOG
- echo ""
- cd $ORACLE_HOME/rdbms/lib
- chmod u+w config.c > /dev/null 2>&1
- if [ ! -f config.cO ] ; then
- cp config.c config.cO > /dev/null 2>&1
- fi
- sed -e "s/#define SS_DBA_GRP.*$/#define SS_DBA_GRP \"$GROUP\"/" config.cO > config.c 2>> $LOG
-
- #
- # Link and install product executables.
- #
- echo ""
- echo "Linking and installing $MKTG_NAME executables..." | tee -a $LOG
- echo ""
- cd $ORACLE_HOME/rdbms/lib
- $MAKE -f oracle.mk ORACLE_HOME=$ORACLE_HOME install osntabst.o >> $LOG 2>&1
- if [ $? != 0 ] ; then
- echo "
- Relinking Error.
- The executable for $MKTG_NAME was not made successfully.
- Please check the log file, and repeat the installation
- procedure for $MKTG_NAME.
- " | tee -a $LOG
- fi
- else
- cd $ORACLE_HOME/rdbms/lib
- $MAKE -f oracle.mk ORACLE_HOME=$ORACLE_HOME osntab.o osntabst.o >> $LOG 2>&1
- if [ $? != 0 ] ; then
- echo "
- Relinking Error.
- $ORACLE_HOME/rdbms/lib/osntab.o was not made successfully.
- Please check the log file, and generate osntab.o by:
- cd $ORACLE_HOME/rdbms/lib
- rm osntab.c
- make -f oracle.mk osntab.o osntabst.o
- " | tee -a $LOG
- fi
- fi # end of LINK_PRODUCT
-
- #
- # Set up init.ora file for this SID.
- #
- echo ""
- if [ "$UPDATE" = "Y" ] ; then
- if [ -f $ORACLE_HOME/dbs/init${ORACLE_SID}.ora ]; then
- echo "Removing obsoleted database startup parameters in"
- echo "($ORACLE_HOME/dbs/init${ORACLE_SID}.ora) for 6.0.27..." |tee -a $LOG
- grep -i -v 'db_block_.*_pct' $ORACLE_HOME/dbs/init${ORACLE_SID}.ora \
- > /tmp/init$$.ora
- mv -f /tmp/init$$.ora $ORACLE_HOME/dbs/init${ORACLE_SID}.ora 2> /dev/null
- else
- echo "$ORACLE_HOME/dbs/init${ORACLE_SID}.ora does not exist!"| tee -a $LOG
- echo "Upgrade to 6.0.27 failed!" | tee -a $LOG
- echo "Exiting ORACLE RDBMS install." | tee -a $LOG
- exit 1
- fi
- #
- # Bring up the database
- #
- echo ""
- echo "Bringing the database up..." | tee -a $LOG
- echo ""
- sqldba command=startup > temp$$.log 2>&1
- fgrep 'Database opened.' temp$$.log > /dev/null 2>&1
- if test $? -gt 0
- then
- echo "Upgrade to 6.0.27 failed!" | tee -a $LOG
- echo "Please check diagnostic output file $LOG"
- echo "and restart the upgrade process."
- cat temp$$.log >> $LOG
- echo "Exiting ORACLE RDBMS install." | tee -a $LOG
- exit 10
- fi
- rm -f temp$$.log
- else
- echo $N "Name of the database? $C"
- DEFLT=$ORACLE_SID ; . $INSTALL_HOME/read.sh; DBNAME=$RDVAR
- echo "Creating database startup parameter file
- ($ORACLE_HOME/dbs/init${ORACLE_SID}.ora)..." | tee -a $LOG
- mv -f $ORACLE_HOME/dbs/init${ORACLE_SID}.ora \
- $ORACLE_HOME/dbs/init${ORACLE_SID}.oraO >> $LOG 2> /dev/null
- sed "s/^db_name.*/db_name = $DBNAME/" $ORACLE_HOME/dbs/init.ora > $ORACLE_HOME/dbs/init${ORACLE_SID}.ora 2>&1
- chmod 664 $ORACLE_HOME/dbs/init${ORACLE_SID}.ora >> $LOG 2>&1
-
- case $LOG_SIZE in
- "") LOG_SIZE=500K ;; # default log file size (bytes)
- esac
- case $DBS_SIZE in
- "") DBS_SIZE=10M ;; # default database size (bytes)
- esac
- case $DBS_FILE in
- "") DBS_FILE=\?/dbs/dbs${ORACLE_SID}.dbf ;;
- esac
- case $LOG_FILE1 in
- "") LOG_FILE1=\?/dbs/log1${ORACLE_SID}.dbf ;;
- esac
- case $LOG_FILE2 in
- "") LOG_FILE2=\?/dbs/log2${ORACLE_SID}.dbf ;;
- esac
-
- echo
- echo "The default database and log files are as follows:
-
- database file: $DBS_SIZE bytes in $DBS_FILE
- log file 1: $LOG_SIZE bytes in $LOG_FILE1
- log file 2: $LOG_SIZE bytes in $LOG_FILE2
-
- "
- echo $N "Is this okay? $C"
- DEFLT=Y ; . $INSTALL_HOME/read.sh; DBCORRECT=$RDVAR
-
- case $DBCORRECT in
- N|n)
- echo $N "Name of the database file? $C"
- DEFLT=$DBS_FILE ; . $INSTALL_HOME/read.sh; DBS_FILE=$RDVAR
-
- echo $N "Size of the database file? $C"
- DEFLT=$DBS_SIZE ; . $INSTALL_HOME/read.sh; DBS_SIZE=$RDVAR
-
- echo $N "Name of log file 1? $C"
- DEFLT=$LOG_FILE1 ; . $INSTALL_HOME/read.sh; LOG_FILE1=$RDVAR
-
- echo $N "Name of log file 2? $C"
- DEFLT=$LOG_FILE2 ; . $INSTALL_HOME/read.sh; LOG_FILE2=$RDVAR
-
- echo $N "Size of the log files? $C"
- DEFLT=$LOG_SIZE ; . $INSTALL_HOME/read.sh; LOG_SIZE=$RDVAR ;;
- esac
-
- case $LOG_SIZE in
- *K|*k)
- LOG_NUM=`echo $LOG_SIZE | sed -e 's/K//' -e 's/k//'`
- LOG_BYTES=`expr $LOG_NUM \* 1024`
- ;;
- *M|*m)
- LOG_NUM=`echo $LOG_SIZE | sed -e 's/M//' -e 's/m//'`
- LOG_BYTES=`expr $LOG_NUM \* 1048576`
- ;;
- *)
- LOG_BYTES=$LOG_SIZE
- ;;
- esac
-
- case $DBS_SIZE in
- *K|*k)
- DBS_NUM=`echo $DBS_SIZE | sed -e 's/K//' -e 's/k//'`
- DBS_BYTES=`expr $DBS_NUM \* 1024`
- ;;
- *M|*m)
- DBS_NUM=`echo $DBS_SIZE | sed -e 's/M//' -e 's/m//'`
- DBS_BYTES=`expr $DBS_NUM \* 1048576`
- ;;
- *)
- DBS_BYTES=$DBS_SIZE
- ;;
- esac
-
- ULIMIT_BYTES=`expr $ULIMIT \* $PHYS_BLK_SIZE`
-
- if [ "$DBS_BYTES" -gt "$ULIMIT_BYTES" -o "$LOG_BYTES" -gt "$ULIMIT_BYTES" ]
- then
- echo ""
- echo "The specified database ($DBS_SIZE) or log ($LOG_SIZE) "
- echo "file size is larger than your ulimit ($ULIMIT). "
- echo "Run root install or consult installation guide to install \"osh\"."
- exit 1
- fi
-
- #
- # Create database & log files and init database.
- #
- echo ""
- echo "Creating and initializing database and log files." | tee -a $LOG
- echo "This may take several minutes. Please be patient..."
- sqldba <<END > temp$$.log 2>&1
- startup nomount
- connect internal
- create database $DBNAME controlfile reuse
- logfile '$LOG_FILE1' size $LOG_SIZE reuse,
- '$LOG_FILE2' size $LOG_SIZE reuse
- datafile '$DBS_FILE' size $DBS_SIZE reuse ;
- END
-
- # a hack to check if create database has succeeded.
- grep 'Statement processed.' temp$$.log >/dev/null 2>&1
- if test $? -gt 0
- then
- echo "Create database Failed." | tee -a $LOG
- echo "Please check diagnostic output file $LOG"
- echo "and restart installation."
- cat temp$$.log >> $LOG
- exit 10
- fi
- rm -f temp$$.log
-
- case $SUPER_USER in
- TRUE) $CHOWN $ORACLE_OWNER $LOG_FILE1 $LOG_FILE2 $DBS_FILE init.log ;;
- esac
-
- #
- # Load System Catalog.
- #
- echo ""
- echo "Installing Data Dictionary Views (sqldba @catalog.sql)." | tee -a $LOG
-
- echo "This may take 20-30 minutes. Please be patient..."
-
- sqldba <<END >> $LOG 2>&1
- set termout off
- connect sys/change_on_install
- @?/rdbms/admin/catalog.sql
- @?/rdbms/admin/expvew.sql
- END
- echo "
- Data Dictionary Views Installed.
- " >> $LOG
-
- #
- # Change the SYS and SYSTEM password
- #
- echo ""
- case "$SYS_PASS" in
- "") ;;
- change_on_install) ;;
- *) echo "Changing SYS account password..." | tee -a $LOG
- sqldba <<! >> $LOG 2>&1 ;;
- connect sys/change_on_install
- grant connect to sys identified by $SYS_PASS;
- !
- esac
- case "$SYSTEM_PASS" in
- "") ;;
- system/manager) ;;
- *) PASS=`basename $SYSTEM_PASS`
- echo "Changing SYSTEM account password..." | tee -a $LOG
- sqldba <<! >> $LOG 2>&1 ;;
- connect system/manager
- grant connect to system identified by $PASS;
- !
- esac
- echo ""
- fi
-
- #
- # Use "touch" to time stamp hidden file, for future verification of
- # product installation.
- touch "$ORACLE_HOME/$product/install/.$product" 2> /dev/null
-
- #
- # Hook for verification scripts -- this must happen last
- #
- case "$ORACLE_VERIFY" in
- T) if [ -f $ORACLE_HOME/$product/install/${product}.verify ] ; then
- ORACLE_INSTALL=T ; export ORACLE_INSTALL
- chmod 755 $ORACLE_HOME/$product/install/${product}.verify
- $ORACLE_HOME/$product/install/${product}.verify
- fi
- #
- # if tcp.install and rdbms.install are both called (e.g. by
- # oracle.install), verify TCP/IP too.
- #
- if [ "$TCP_INSTALL" = "T" ] ; then
- if [ -f $ORACLE_HOME/tcp/install/tcp.verify ] ; then
- chmod 755 $ORACLE_HOME/tcp/install/tcp.verify
- $ORACLE_HOME/tcp/install/tcp.verify
- fi
- fi
- #
- # if async.install and rdbms.install are both called (e.g. by
- # oracle.install), verify ASYNC too.
- #
- if [ "$ASYNC_INSTALL" = "T" ] ; then
- if [ -f $ORACLE_HOME/async/install/async.verify ] ; then
- chmod 755 $ORACLE_HOME/async/install/async.verify
- $ORACLE_HOME/async/install/async.verify
- fi
- fi
- #
- # if dnt.install and rdbms.install are both called (e.g. by
- # oracle.install), verify DNT too.
- #
- if [ "$DNT_INSTALL" = "T" ] ; then
- if [ -f $ORACLE_HOME/dnt/install/dnt.verify ] ; then
- chmod 755 $ORACLE_HOME/dnt/install/dnt.verify
- $ORACLE_HOME/dnt/install/dnt.verify
- fi
- fi
- #
- # if plsql.install and rdbms.install are both called (e.g. by
- # oracle.install), verify PL/SQL too.
- #
- if [ "$PLSQL_INSTALL" = "T" ] ; then
- if [ -f $ORACLE_HOME/plsql/install/plsql.verify ] ; then
- chmod 755 $ORACLE_HOME/plsql/install/plsql.verify
- $ORACLE_HOME/plsql/install/plsql.verify
- fi
- fi
- #
- # if tpo.install and rdbms.install are both called (e.g. by
- # oracle.install), verify the transaction processing option too.
- #
- if [ "$TPO_INSTALL" = "T" ] ; then
- if [ -f $ORACLE_HOME/tpo/install/tpo.verify ] ; then
- $ORACLE_HOME/tpo/install/tpo.verify
- fi
- fi
- ;;
- esac
-
- #
- # Cleanup and exit code.
- #
- echo ""
- case $UPDATE in
- Y) echo "$MKTG_NAME update completed." | tee -a $LOG ;;
- *) echo "$MKTG_NAME installation completed." | tee -a $LOG ;;
- esac
- echo ""
- sync;sync;sync
- exit 0
-