Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: dbstart and Oracle 8.1.6

Re: dbstart and Oracle 8.1.6

From: Danut Bancea <danut_at_telepages.ca>
Date: Fri, 1 Sep 2000 16:21:13 -0400
Message-Id: <10606.116095@fatcity.com>


This is a multi-part message in MIME format.

------=_NextPart_000_046F_01C01430.A5D52950 Content-Type: text/plain;

        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi Diana ,

There is a bug in dbstart file and Oracle provide a workaround.

Anyway I attached the dbstart which I fixed ( OS is Sun Solaris).

I don't remember the note, you can find it on metalink.

The changes affected next line (with header from svrmgrl )

   /PL\/SQL (Release|Version)/ {print substr($3,1,3);exit}

                        /Oracle7 Server (Release|Version)/ {print
substr($4,1,4); exit }
                        /Oracle8i Enterprise Edition (Release|Version)/
{print substr($5,1,3); exit;}'`

I attached also the file, but I not sure that you can downloaded. If you need the file send me an email again to send directly to you.

I ftp the file on Windows with ascii option.

Danut,

Next is the file content.


:
#
# $Header: dbstart.sh.pp 09-dec-99.09:51:46 mdenney Exp $ dbstart.sh.pp
Copyr (c) 1991 Oracle
#

###################################
#
# usage: dbstart
#
# This script is used to start ORACLE from /etc/rc(.local).
# It should ONLY be executed as part of the system boot procedure.
#
#####################################

ORATAB=/var/opt/oracle/oratab

trap 'exit' 1 2 3
case $ORACLE_TRACE in

    T) set -x ;;
esac

# Set path if path not set (if called from /etc/rc)
case $PATH in

    "") PATH=/bin:/usr/bin:/etc
 export PATH ;;
esac

#
# Loop for every entry in oratab file and and try to start
# that ORACLE
#

cat $ORATAB | while read LINE
do

    case $LINE in
 \#*) ;; #comment-line in oratab
 *)
# Proceed only if third field is 'Y'.

        if [ "`echo $LINE | awk -F: '{print $3}' -`" = "Y" ] ; then
            ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
     if [ "$ORACLE_SID" = '*' ] ; then
  ORACLE_SID=""
     fi

# Called programs use same database ID
export ORACLE_SID ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
# Called scripts use same home directory
export ORACLE_HOME
# Put $ORACLE_HOME/bin into PATH and export.
PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc ; export PATH
# add for bug # 652997
LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH} ; export
LD_LIBRARY_PATH             PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora

# Figure out if this is a V5, V6, or V7 database. Do we really need V5?

     if [ -f $ORACLE_HOME/bin/sqldba ] ; then   VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '

                 /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
   print V[1]}'`
     else
  if test -f $ORACLE_HOME/bin/svrmgrl; then
      VERSION=`$ORACLE_HOME/bin/svrmgrl command=exit | awk '
   /PL\/SQL (Release|Version)/ {print substr($3,1,3);exit}
                        /Oracle7 Server (Release|Version)/ {print
substr($4,1,4); exit }
                        /Oracle8i Enterprise Edition (Release|Version)/
{print substr($5,1,3); exit;}'`
      else
   VERSION="8.2"
      fi
     fi

     STATUS=1
     if [ "$VERSION" = "8.1" ]

  then
  pmon=`ps -ef | egrep pmon_$ORACLE_SID | grep -v grep`   if [ "$pmon" != "" ];
  then
    STATUS="-1"
    echo "Database \"${ORACLE_SID}\" already started."   fi

     else
  if test -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.dbf -o \

       -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.ora
       then
        STATUS="-1"
       else
    STATUS=1
       fi
     fi

     case $STATUS in
                1)  if [ -f $PFILE ] ; then
   case $VERSION in
       6)  sqldba command=startup

    ;;

       7) sqldba <<EOF
connect internal
startup
EOF
    ;;

      7.3) svrmgrl <<EOF
connect internal
startup
EOF
    ;;
      8.0) svrmgrl <<EOF
connect internal
startup
EOF
    ;;
      8.1) sqlplus /nolog <<EOF
connect internal
startup
EOF
    ;;
   esac

                        if test $? -eq 0 ; then
       echo ""
              echo "Database \"${ORACLE_SID}\" warm started."
   else
       echo ""
                            echo "Database \"${ORACLE_SID}\" NOT started."
          fi
                    else
   echo ""
                        echo "Can't find init file for Database
\"${ORACLE_SID}\"."
                        echo "Database \"${ORACLE_SID}\" NOT started."
      fi
                    ;;

  -1) echo ""
      echo "Database \"${ORACLE_SID}\" possibly left running when system
went down (system crash?)."
                    echo "Notify Database Administrator."
      case $VERSION in
   6)  sqldba "command=shutdown abort"
       ;;

   7) sqldba <<EOF
connect internal
shutdown abort
EOF
       ;;

        7.3) svrmgrl <<EOF
connect internal
shutdown abort
EOF

       ;;
        8.0) svrmgrl <<EOF

connect internal
shutdown abort
EOF
       ;;
        8.1) sqlplus /nolog <<EOF

connect internal
shutdown abort
EOF
       ;;

      esac

                    if test $? -eq 0 ; then
   if [ -f $PFILE ] ; then
       case $VERSION in
    6)  sqldba command=startup
        ;;

    7) sqldba <<EOF
connect internal
startup
EOF

        ;;
         7.3)  svrmgrl <<EOF

connect internal
startup
EOF
        ;;
         8.0) svrmgrl <<EOF

connect internal
startup
EOF
        ;;
         8.1) sqlplus /nolog <<EOF

connect internal
startup
EOF
        ;;
       esac
                            if test $? -eq 0 ; then
    echo ""
    echo "Database \"${ORACLE_SID}\" warm started."

       else
    echo ""
    echo "Database \"${ORACLE_SID}\" NOT started."

       fi
   else

       echo ""
       echo "Can't find init file for Database \"${ORACLE_SID}\"."
       echo "Database \"${ORACLE_SID}\" NOT started."
   fi
      else
   echo "Database \"${ORACLE_SID}\" NOT started."
      fi
      ;;
            esac
        fi

 ;;

    esac
done




Danut Bancea
Oracle DBA

Tele-Pages Inc.
Phone : (416) 296-9011 Ext. 2271
Fax : (905) 477-7062
E-mail : danut_at_telepages.ca


> I encountered something today that may affect others who migrate to 8.1.6
> (Solaris 2.7), which I did a few weeks ago:
>
> Our development server went down due to a power outage, and when it came
> back up the databases did not.  I tried to run dbstart (which is called
from
> the /etc/rc2.d) and it claimed that all the databases were warm started
> without running anything.  There is a line in dbstart which checks for the
> version, and it looked like this:
>
>                 if test -f $ORACLE_HOME/bin/svrmgrl; then
>                     VERSION=`$ORACLE_HOME/bin/svrmgrl command=exit | awk '
>                         /PL\/SQL (Release|Version)/ {substr($3,1,3) ;
>                         print substr($3,1,3)}'`
>                 else
>                         VERSION="8.2"
>                 fi
>
> I ran svrmgrl command=exit, and received the following:
> Oracle Server Manager Release 3.1.6.0.0 - Production
>
> Copyright (c) 1997, 1999, Oracle Corporation.  All Rights Reserved.
>
> Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
> With the Partitioning option
> JServer Release 8.1.6.0.0 - Production
>
> Server Manager complete.
>
> Notice no line with PL/SQL in it?  I had to change the dbstart text to
read
> the following, which I doubt will translate to other versions, but at least
> will work with the ones I have here.  Does anyone have a fix that is more
> generic?
>
>                 if test -f $ORACLE_HOME/bin/svrmgrl; then
>                     VERSION=`$ORACLE_HOME/bin/svrmgrl command=exit | awk '
>                         /Oracle.* Edition (Release|Version)/
{substr($5,1,3)
> ;
>                         print substr($5,1,3)}'`
>                 else
>                         VERSION="8.2"
>                 fi
>
> Diana Duncan
> Database Architect
> fileFrenzy.com
> diana_at_filefrenzy.com
> 919.833.1766 x 238
>
> --
> Author: Diana Duncan
>   INET: Diana_at_fileFRENZY.com
>
> Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California        -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
>

------=_NextPart_000_046F_01C01430.A5D52950 Content-Type: application/octet-stream;

        name="dbstart"
Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment;

        filename="dbstart"

:
#
# $Header: dbstart.sh.pp 09-dec-99.09:51:46 mdenney Exp $ dbstart.sh.pp =
Copyr (c) 1991 Oracle
#

###################################
#=20
# usage: dbstart
#
# This script is used to start ORACLE from /etc/rc(.local).
# It should ONLY be executed as part of the system boot procedure.
#
#####################################

ORATAB=3D/var/opt/oracle/oratab

trap 'exit' 1 2 3
case $ORACLE_TRACE in

    T) set -x ;;
esac

   =20
# Set path if path not set (if called from /etc/rc)
case $PATH in

    "")	PATH=3D/bin:/usr/bin:/etc
	export PATH ;;

esac

#
# Loop for every entry in oratab file and and try to start
# that ORACLE
#

cat $ORATAB | while read LINE
do

    case $LINE in

	\#*)		;;	#comment-line in oratab
	*)

# Proceed only if third field is 'Y'.
if [ "`echo $LINE | awk -F: '{print $3}' -`" =3D "Y" ] ; then ORACLE_SID=3D`echo $LINE | awk -F: '{print $1}' -` if [ "$ORACLE_SID" =3D '*' ] ; then ORACLE_SID=3D"" fi
# Called programs use same database ID
export ORACLE_SID ORACLE_HOME=3D`echo $LINE | awk -F: '{print $2}' -`
# Called scripts use same home directory
export ORACLE_HOME
# Put $ORACLE_HOME/bin into PATH and export.
PATH=3D$ORACLE_HOME/bin:/bin:/usr/bin:/etc ; export PATH
# add for bug # 652997
LD_LIBRARY_PATH=3D${ORACLE_HOME}/lib:${LD_LIBRARY_PATH} ; =
export LD_LIBRARY_PATH

            PFILE=3D${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora

# Figure out if this is a V5, V6, or V7 database. Do we really need V5?

	    if [ -f $ORACLE_HOME/bin/sqldba ] ; then
		VERSION=3D`$ORACLE_HOME/bin/sqldba command=3Dexit | awk '
	                /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
			print V[1]}'`
	    else
		if test -f $ORACLE_HOME/bin/svrmgrl; then
		    VERSION=3D`$ORACLE_HOME/bin/svrmgrl command=3Dexit | awk '
			/PL\/SQL (Release|Version)/ {print substr($3,1,3);exit}
                        /Oracle7 Server (Release|Version)/ {print =
substr($4,1,4); exit }
                        /Oracle8i Enterprise Edition (Release|Version)/ =
{print substr($5,1,3); exit;}'`
	    	else
			VERSION=3D"8.2"
	    	fi
	    fi

	    STATUS=3D1
	    if [ "$VERSION" =3D "8.1" ]=20
		then
		pmon=3D`ps -ef | egrep pmon_$ORACLE_SID  | grep -v grep`
		if [ "$pmon" !=3D "" ];=20
		then
		  STATUS=3D"-1"
		  echo "Database \"${ORACLE_SID}\" already started."
		fi
	    else=20
		if test -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.dbf -o \
		     -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.ora
	      then
	    	  STATUS=3D"-1"
	      else
		  STATUS=3D1
	      fi
	    fi

	    case $STATUS in
                1)  if [ -f $PFILE ] ; then
			case $VERSION in
			    6)  sqldba command=3Dstartup
				;;

			    7)  sqldba <<EOF

connect internal
startup
EOF
                                ;;

                           7.3) svrmgrl <<EOF
connect internal
startup
EOF

				;;
			   8.0) svrmgrl <<EOF

connect internal
startup
EOF
				;;
			   8.1) sqlplus /nolog <<EOF

connect internal
startup
EOF
				;;
			esac

                        if test $? -eq 0 ; then
			    echo ""
		            echo "Database \"${ORACLE_SID}\" warm started."
			else
			    echo ""
                            echo "Database \"${ORACLE_SID}\" NOT =
started."
		        fi
                    else
			echo ""
                        echo "Can't find init file for Database =
\"${ORACLE_SID}\"."
                        echo "Database \"${ORACLE_SID}\" NOT started."
		    fi
                    ;;

		-1) echo ""
		    echo "Database \"${ORACLE_SID}\" possibly left running when system =
went down (system crash?)."
                    echo "Notify Database Administrator."
		    case $VERSION in
			6)  sqldba "command=3Dshutdown abort"
			    ;;

			7)  sqldba <<EOF

connect internal
shutdown abort
EOF
                            ;;

                      7.3) svrmgrl <<EOF
connect internal
shutdown abort
EOF

			    ;;
		      8.0) svrmgrl <<EOF

connect internal
shutdown abort
EOF
			    ;;
		      8.1) sqlplus /nolog <<EOF

connect internal
shutdown abort
EOF
                            ;;

                    esac

                    if test $? -eq 0 ; then
			if [ -f $PFILE ] ; then
			    case $VERSION in
				6)  sqldba command=3Dstartup
				    ;;

				7)  sqldba <<EOF

connect internal
startup
EOF
				    ;;
			      7.3)  svrmgrl <<EOF

connect internal
startup
EOF
				    ;;
			      8.0) svrmgrl <<EOF

connect internal
startup
EOF
				    ;;
			      8.1) sqlplus /nolog <<EOF

connect internal
startup
EOF
                                    ;; Received on Fri Sep 01 2000 - 15:21:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US