亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 如何使Oracle10g在HPUX11下開機(jī)自動(dòng)啟動(dòng)關(guān)機(jī)自動(dòng)關(guān)閉?! [打印本頁]

作者: noise    時(shí)間: 2006-09-13 18:32
標(biāo)題: 如何使Oracle10g在HPUX11下開機(jī)自動(dòng)啟動(dòng)關(guān)機(jī)自動(dòng)關(guān)閉?!
在#下運(yùn)行:
#su - oracle
$/opt/oracle/bin/dbstart

提示監(jiān)聽啟動(dòng)錯(cuò)誤
LSNRCTL for HPUX: Version 10.2.0.1.0 - Production on 13-SEP-2006 11:31:38

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Message 1070 not found; No message file for product=network, facility=TNSTNS-12545: Message 12545 not found; No message file for product=network, facility=TNS
TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
  TNS-00515: Message 515 not found; No message file for product=network, facility=TNS
   HPUX Error: 2: No such file or directory

而用ORACLE登錄運(yùn)行dbstart就能正常的執(zhí)行。在這種情況下,應(yīng)該如何在/sbin/rc.d中添加啟動(dòng)和關(guān)閉腳本??
作者: blue_stone    時(shí)間: 2006-09-13 22:14
oracle環(huán)境變量沒有生效?
編寫一個(gè)腳本, 設(shè)置ORACLE_HOME, ORACLE_BASE, ORACLE_SID等環(huán)境變量, 并啟動(dòng)數(shù)據(jù)庫.
然后讓系統(tǒng)啟動(dòng)后運(yùn)行這個(gè)腳本.
作者: noise    時(shí)間: 2006-09-14 15:57
原帖由 blue_stone 于 2006-9-13 22:14 發(fā)表
oracle環(huán)境變量沒有生效?
編寫一個(gè)腳本, 設(shè)置ORACLE_HOME, ORACLE_BASE, ORACLE_SID等環(huán)境變量, 并啟動(dòng)數(shù)據(jù)庫.
然后讓系統(tǒng)啟動(dòng)后運(yùn)行這個(gè)腳本.


我把oracle下的.dtprofile中的環(huán)境變量文件添加到dbstart文件里,并且在啟動(dòng)監(jiān)聽和數(shù)據(jù)庫之前,但執(zhí)行dbstart時(shí)還是有關(guān)于監(jiān)聽的錯(cuò)誤。

dbstart.JPG (65.98 KB, 下載次數(shù): 84)

執(zhí)行dbstart后的報(bào)錯(cuò)

執(zhí)行dbstart后的報(bào)錯(cuò)

dbshut.JPG (64.22 KB, 下載次數(shù): 83)

執(zhí)行dbshut后的報(bào)錯(cuò)

執(zhí)行dbshut后的報(bào)錯(cuò)

作者: noise    時(shí)間: 2006-09-14 16:35
把兩個(gè)腳本放在/sbin/rc2.d中并重新啟動(dòng)服務(wù)器后,數(shù)據(jù)庫沒有運(yùn)行腳本并沒有執(zhí)行,通過ps -u oracle沒有任何結(jié)果顯示。添加腳本文件還需要什么特別注意的嗎?!
作者: blue_stone    時(shí)間: 2006-09-14 21:19
腳本能貼出來看看么?
我還是感覺你的腳本中環(huán)境變量設(shè)置有問題
作者: numenhuang    時(shí)間: 2006-09-14 21:39
原帖由 noise 于 2006-9-14 16:35 發(fā)表
把兩個(gè)腳本放在/sbin/rc2.d中并重新啟動(dòng)服務(wù)器后,數(shù)據(jù)庫沒有運(yùn)行腳本并沒有執(zhí)行,通過ps -u oracle沒有任何結(jié)果顯示。添加腳本文件還需要什么特別注意的嗎?!


啟動(dòng)oracle腳本最好放在rc3.d,命名格式Sxxx, 注意權(quán)限 chown bin:bin Sxxx
關(guān)閉oracle腳本(如果啟動(dòng)是放在rc3.d)應(yīng)該放在rc2.d, 命名格式Kxxx,

手工執(zhí)行該腳本能否執(zhí)行成功。
作者: doni    時(shí)間: 2006-09-15 08:39
HP-UX沒用過,就SOLARIS下的情況而言,有這樣幾點(diǎn)
首先,應(yīng)該注意你的.profile,而不是.dtprofile
其次,自動(dòng)啟動(dòng)和關(guān)閉的腳本可以寫成這樣
su - oracle -c "dbstart; lsnrctl start"
還有就是,啟動(dòng)腳本建議用S99...,關(guān)閉腳本建議用K00...
作者: noise    時(shí)間: 2006-09-15 09:12
原帖由 blue_stone 于 2006-9-14 21:19 發(fā)表
腳本能貼出來看看么?
我還是感覺你的腳本中環(huán)境變量設(shè)置有問題


dbstart:

:
#
# $Id: dbstart.sh.pp 11-may-2005.18:18:07 vikrkuma Exp $
# Copyright (c) 1991, 2005, Oracle. All rights reserved.  
#

###################################
#
# 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.
#
# This script will start all databases listed in the oratab file
# whose third field is a "Y".  If the third field is set to "Y" and
# there is no ORACLE_SID for an entry (the first field is a *),
# then this script will ignore that entry.
#
# This script requires that ASM ORACLE_SID's start with a +, and
# that non-ASM instance ORACLE_SID's do not start with a +.
#
# If ASM instances are to be started with this script, it cannot
# be used inside an rc*.d directory, and should be invoked from
# rc.local only. Otherwise, the CSS service may not be available
# yet, and this script will block init from completing the boot
# cycle.
#
# Note:
# Use ORACLE_TRACE=T for tracing this script.
#
# The progress log for each instance bringup plus Error and Warning message
# are logged in file $ORACLE_HOME/startup.log. The error messages related to
# instance bringup are also logged to syslog (system log module).
# The Listener log is located at $ORACLE_HOME_LISTNER/listener.log
#
# To configure:
# 1) Set ORATAB:
#    On Solaris
#      ORATAB=/var/opt/oracle/oratab
#    All other UNIX platforms
#      ORATAB=/etc/oratab
#
# 2) Update $ORATAB/oratab with Database Instances that need to be started up.
#    Entries are of the form:
#    $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#    An example entry:
#    main:/usr/lib/oracle/emagent_10g:Y
#
# 3) Set ORACLE_HOME_LISTNER
#    Set this to enable auto startup for Oracle Net Listener.
#    The script uses this find the binary to start Net Listener.
#
#    Also, if the listener name is not the default name LISTENER, you must
#    specify the listener name in the stop and start commands:
#    $ORACLE_HOME/bin/lsnrctl {start|stop} listener_name
#
#####################################

LOGMSG="logger -puser.alert -s "

trap 'exit' 1 2 3

# for script tracing
case $ORACLE_TRACE in
    T) set -x ;;
esac
   
# Set path if path not set (if called from /etc/rc)
case $PATH in
    "") ORACLE_BASSE=/opt/oracle
        ORACLE_HOME=/opt/oracle
        ORACLE_SID=orcl
        ORACLE_TERM=xterm
        export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_TERM
        NLS_LANG=american_america.ZHS16GB231280
        exprot NLS_LANG
        ORA_LNS33=$ORACLE_HOME/ocommon/nls/admin/data
        exprot ORA_LNS33
        

LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/usr/lib:$ORACLE_HOME/RDBMS/

lib:$ORACLE_HOME/lib32
        SHLIB_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib32
        export SHLIB_PATH LD_LIBRARY_PATH
        

PATH=/bin:/usr/bin:/usr/sbin:/opt/bin:/usr/local/bin:$ORACLE_HOME/bin:/usr/contrib

/bin:/$PATH
        export PATH
        CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
        CLASSPATH=$CLASSPAHT:$ORACLE_HOME/network/jlib
        exprot CLASSPATH
        


PATH=/bin:/usr/bin:/usr/sbin:/opt/bin:/usr/local/bin:$ORACLE_HOME/bin:/usr/contrib

/bin:/$PATH
        export PATH ;;
esac

# Save LD_LIBRARY_PATH
SAVE_LLP=$LD_LIBRARY_PATH

# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=/opt/oracle
export ORACLE_HOME_LISTNER
if [ ! $ORACLE_HOME_LISTNER ] ; then
  echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
else
  LOG=$ORACLE_HOME_LISTNER/listener.log

  # Start Oracle Net Listener
  $ORACLE_HOME_LISTNER/bin/lsnrctl start
fi

# Set this in accordance with the platform
ORATAB=/etc/oratab
if [ ! $ORATAB ] ; then
  echo "Set ORATAB to dir where oratab file is located"
  exit 1;
fi

# Checks Version Mismatch between Listener and Database Instance.
# A version 10 listener is required for an Oracle Database 10g database.
# Previous versions of the listener are not supported for use with an Oracle
# Database 10g database. However, it is possible to use a version 10 listener
# with previous versions of the Oracle database.
checkversionmismatch() {
  if [ $VER10LIST ] ; then
    VER10INST=`sqlplus -V | grep "Release " | cut -d' ' -f3 | cut -d'.' -f1`
    case $VER10INST in
      "10")
      if [ $VER10LIST != "10" ] ; then
        $LOGMSG "Warning: Version 10 listener is required for Oracle Database 10g"
        $LOGMSG "Version $VER10LIST for Listener is NOT supported with Database

version $VER10INST"
        $LOGMSG "Restart Oracle Net Listener using an alternate

ORACLE_HOME_LISTNER: lsnrctl start"
      fi
      ;;
      *) ;;
    esac
  fi
}

# Starts a Database Instance
startinst() {
  # Called programs use same database ID
  export ORACLE_SID

  # 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=${SAVE_LLP}:${ORACLE_HOME}/lib ; export LD_LIBRARY_PATH
  PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora
  SPFILE=${ORACLE_HOME}/dbs/spfile${ORACLE_SID}.ora
  SPFILE1=${ORACLE_HOME}/dbs/spfile.ora

  echo ""
  echo "$0: Starting up database \"$ORACLE_SID\""
  date
  echo ""

  checkversionmismatch

  # See if it is a V6 or V7 database
  VERSION=undef
  if [ -f $ORACLE_HOME/bin/sqldba ] ; then
    SQLDBA=sqldba
    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
      /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
      print V[1]}'`
    case $VERSION in
      "6") ;;
      *) VERSION="internal" ;;
    esac
  else
    if [ -f $ORACLE_HOME/bin/svrmgrl ] ; then
      SQLDBA=svrmgrl
      VERSION="internal"
    else
      SQLDBA="sqlplus /nolog"
    fi
  fi

  STATUS=1
  if [ -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.dbf ] ; then
    STATUS="-1"
  fi
  if [ -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.ora ] ; then
    STATUS="-1"
  fi
  pmon=`ps -ef | egrep pmon_$ORACLE_SID  | grep -v grep`
  if [ "$pmon" != "" ];
  then
    STATUS="-1"
    $LOGMSG "Warning: ${INST} \"${ORACLE_SID}\" already started."
  fi

  if test $STATUS -eq -1 ; then
    $LOGMSG "Warning: ${INST} \"${ORACLE_SID}\" possibly left running when system

went down (system crash?)."
    $LOGMSG "Action: Notify Database Administrator."
    case $VERSION in
      "6")  sqldba "command=shutdown abort" ;;
      "internal")  $SQLDBA $args <<EOF
connect internal
shutdown abort
EOF
        ;;
      *)  $SQLDBA $args <<EOF
connect / as sysdba
shutdown abort
quit
EOF
        ;;
    esac

    if test $? -eq 0 ; then
      STATUS=1
    else
      $LOGMSG "Error: ${INST} \"${ORACLE_SID}\" NOT started."
    fi
  fi

  if test $STATUS -eq 1 ; then
    if [ -f $SPFILE -o -f $SPFILE1 -o -f $PFILE ] ; then
      case $VERSION in
        "6")  sqldba command=startup ;;
        "internal")  $SQLDBA <<EOF
connect internal
startup
EOF
          ;;
        *)  $SQLDBA <<EOF
connect / as sysdba
startup
quit
EOF
          ;;
      esac

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

# Starts an ASM Instance
startasminst() {
  # 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

  # For ASM instances, we have a dependency on the CSS service.
  # Wait here for it to become available before instance startup.

  # Is the 10g install intact? Are all necessary binaries present?
  if [ ! -f $ORACLE_HOME/bin/crsctl ]; then
    $LOGMSG "$ORACLE_HOME/bin/crsctl not found when attempting to start"
    $LOGMSG "  ASM instance $ORACLE_SID."

  else
    COUNT=0
    $ORACLE_HOME/bin/crsctl check css
    RC=$?
    while [ "$RC" != "0" ];
    do
    COUNT=$((COUNT+1))
    if [ $COUNT = 15 ] ; then
      # 15 tries with 20 sec interval => 5 minutes timeout
      $LOGMSG "Timed out waiting to start ASM instance $ORACLE_SID"         
      $LOGMSG "  CSS service is NOT available."
      exit $COUNT
    fi
    $LOGMSG "Waiting for Oracle CSS service to be available before starting "
    $LOGMSG " ASM instance $ORACLE_SID. Wait $COUNT."

    sleep 20
    $ORACLE_HOME/bin/crsctl check css
    RC=$?
    done
  fi
  startinst
}

# Start of dbstartup script
#
# Loop for every entry in oratab file and and try to start
# that ORACLE.
#
# ASM instances need to be started before 'Database instances'
# ASM instance is identified with '+' prefix in ORACLE_SID
# Following loop brings up ASM instance

cat $ORATAB | while read LINE
do
case $LINE in
  \#*)                ;;        #comment-line in oratab
  *)
  # Proceed only if last field is 'Y'.
  # Entries whose last field is not Y or N are not DB entry, ignore them.
  if [ "`echo $LINE | awk -F: '{print $NF}' -`" = "Y" ] ; then
    ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
    if [ "$ORACLE_SID" = '*' ] ; then
      # same as NULL SID - ignore this entry
      ORACLE_SID=""
      continue
    fi
    # For ASM instances, we have a dependency on the CSS service.
    # Wait here for it to become available before instance startup.
    if [ `echo $ORACLE_SID | cut -b 1` = '+' ]; then
      INST="ASM instance"
      ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
      # Called scripts use same home directory
      export ORACLE_HOME
      # file for logging script's output
      LOG=$ORACLE_HOME/startup.log
      touch $LOG
      chmod a+r $LOG
      echo "Processing $INST \"$ORACLE_SID\": log file $ORACLE_HOME/startup.log"
      startasminst >> $LOG 2>&1
    fi
  fi
  ;;
esac
done

# exit if there was any trouble bringing up ASM instance
if [ "$?" != "0" ] ; then
  exit 2
fi

#
# Following loop brings up 'Database instances'
#
cat $ORATAB | while read LINE
do
case $LINE in
  \#*)                ;;        #comment-line in oratab
  *)
  # Proceed only if last field is 'Y'.
  # Entries whose last field is not Y or N are not DB entry, ignore them.
  if [ "`echo $LINE | awk -F: '{print $NF}' -`" = "Y" ] ; then
    ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
    if [ "$ORACLE_SID" = '*' ] ; then
      # same as NULL SID - ignore this entry
      ORACLE_SID=""
      continue
    fi
    # For ASM instances, we have a dependency on the CSS service.
    # Wait here for it to become available before instance startup.
    if [ `echo $ORACLE_SID | cut -b 1` != '+' ]; then
      INST="Database instance"
      ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
      # Called scripts use same home directory
      export ORACLE_HOME
      # file for logging script's output
      LOG=$ORACLE_HOME/startup.log
      touch $LOG
      chmod a+r $LOG
      echo "Processing $INST \"$ORACLE_SID\": log file $ORACLE_HOME/startup.log"
      startinst >> $LOG 2>&1
    fi
  fi
  ;;
esac
done


dbshut:

:
#
# $Id: dbshut.sh.pp 11-may-2005.19:37:00 vikrkuma Exp $
# Copyright (c) 1991, 2005, Oracle. All rights reserved.  
#

###################################
#
# usage: dbshut
#
# This script is used to shutdown ORACLE from /etc/rc(.local).
# It should ONLY be executed as part of the system boot procedure.
#
# This script will shutdown all databases listed in the oratab file
# whose third field is a "Y".  If the third field is set to "Y" and
# there is no ORACLE_SID for an entry (the first field is a *),
# then this script will ignore that entry.
#
# This script requires that ASM ORACLE_SID's start with a +, and
# that non-ASM instance ORACLE_SID's do not start with a +.
#
# Note:
# Use ORACLE_TRACE=T for tracing this script.
# Oracle Net Listener is NOT shutdown using this script.
#
# The progress log for each instance shutdown is logged in file
# $ORACLE_HOME/shutdown.log.
#
# To configure:
# 1) Set ORATAB:
#    On Solaris
#      ORATAB=/var/opt/oracle/oratab
#    All other UNIX platforms
#      ORATAB=/etc/oratab
#
# 2) Update $ORATAB/oratab with Database Instances that need to be shutdown.
#    Entries are of the form:
#    $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#    An example entry:
#    main:/usr/lib/oracle/emagent_10g:Y
#
#####################################

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
  "") ORACLE_BASSE=/opt/oracle
      ORACLE_HOME=/opt/oracle
      ORACLE_SID=orcl
      ORACLE_TERM=xterm
      export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_TERM
      NLS_LANG=american_america.ZHS16GB231280
      exprot NLS_LANG
      ORA_LNS33=$ORACLE_HOME/ocommon/nls/admin/data
      exprot ORA_LNS33
      LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/usr/lib:$ORACLE_HOME/RDBMS/lib:$ORACLE_HOME/lib32
      SHLIB_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib32
      export SHLIB_PATH LD_LIBRARY_PATH
      PATH=/bin:/usr/bin:/usr/sbin:/opt/bin:/usr/local/bin:$ORACLE_HOME/bin:/usr/contrib/bin:/$PATH
      export PATH
      CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
      CLASSPATH=$CLASSPAHT:$ORACLE_HOME/network/jlib
      exprot CLASSPATH
      PATH=/bin:/usr/bin:/usr/sbin:/opt/bin:/usr/local/bin:$ORACLE_HOME/bin:/usr/contrib/bin:/$PATH
      export PATH ;;
esac

# Save LD_LIBRARY_PATH
SAVE_LLP=$LD_LIBRARY_PATH

# Set this in accordance with the platform
ORATAB=/etc/oratab
if [ ! $ORATAB ] ; then
  echo "Set ORATAB to dir where oratab file is located"
  exit 1;
fi

# Stops an instance
stopinst() {
  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=${SAVE_LLP}:${ORACLE_HOME}/lib ; export LD_LIBRARY_PATH
  PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora

# See if it is a V6 or V7 database
  VERSION=undef
  if [ -f $ORACLE_HOME/bin/sqldba ] ; then
    SQLDBA=sqldba
    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
      /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
      print V[1]}'`
    case $VERSION in
      "6") ;;
      *) VERSION="internal" ;;
    esac
  else
    if [ -f $ORACLE_HOME/bin/svrmgrl ] ; then
      SQLDBA=svrmgrl
      VERSION="internal"
    else
      SQLDBA="sqlplus /nolog"
    fi
  fi

  case $VERSION in
    "6")  sqldba command=shutdown ;;
    "internal")  $SQLDBA <<EOF
connect internal
shutdown immediate
EOF
     ;;
     *)  $SQLDBA <<EOF
connect / as sysdba
shutdown immediate
quit
EOF
     ;;
  esac

  if test $? -eq 0 ; then
    echo "${INST} \"${ORACLE_SID}\" shut down."
  else
    echo "${INST} \"${ORACLE_SID}\" not shut down."
  fi
}

#
# Loop for every entry in oratab file and and try to shut down
# that ORACLE
#
# Following loop shuts down 'Database Instance'

cat $ORATAB | while read LINE
do
  case $LINE in
    \#*)                ;;        #comment-line in oratab
    *)
    # Proceed only if last field is 'Y'.
    # Entries whose last field is not Y or N are not DB entry, ignore them.
    if [ "`echo $LINE | awk -F: '{print $NF}' -`" = "Y" ] ; then
      ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
      if [ "$ORACLE_SID" = '*' ] ; then
        # NULL SID - ignore
        ORACLE_SID=""
        continue
      fi
    if [ `echo $ORACLE_SID | cut -b 1` != '+' ]; then
      INST="Database instance"
      ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
      LOG=$ORACLE_HOME/shutdown.log
      stopinst >> $LOG 2>&1
    fi
  fi
  ;;
  esac
done

#
# Following loop shuts down 'ASM Instance'
#

cat $ORATAB | while read LINE
do
  case $LINE in
    \#*)                ;;        #comment-line in oratab
    *)
    # Proceed only if last field is 'Y'.
    # Entries whose last field is not Y or N are not DB entry, ignore them.
    if [ "`echo $LINE | awk -F: '{print $NF}' -`" = "Y" ] ; then
      ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
      if [ "$ORACLE_SID" = '*' ] ; then
        # NULL SID - ignore
        ORACLE_SID=""
        continue
      fi
    if [ `echo $ORACLE_SID | cut -b 1` = '+' ]; then
      INST="ASM instance"
      ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
      LOG=$ORACLE_HOME/shutdown.log
      stopinst >> $LOG 2>&1
    fi
  fi
  ;;
  esac
done

# Stop Oracle Net Listener
$ORACLE_HOME/bin/lsnrctl stop



紅色部分是我后加的。另外,dbstart里關(guān)于監(jiān)聽的啟動(dòng)原來是有一組判斷,我給簡化成“$ORACLE_HOME_LISTNER/bin/lsnrctl start”。

[ 本帖最后由 blue_stone 于 2006-9-15 09:23 編輯 ]
作者: doni    時(shí)間: 2006-09-15 09:23
su - oracle后,set|grep ORACLE
把結(jié)果貼一下
作者: noise    時(shí)間: 2006-09-15 09:32
原帖由 numenhuang 于 2006-9-14 21:39 發(fā)表


啟動(dòng)oracle腳本最好放在rc3.d,命名格式Sxxx, 注意權(quán)限 chown bin:bin Sxxx
關(guān)閉oracle腳本(如果啟動(dòng)是放在rc3.d)應(yīng)該放在rc2.d, 命名格式Kxxx,

手工執(zhí)行該腳本能否執(zhí)行成功。


原來確實(shí)沒注意文件所有權(quán),現(xiàn)在改了系統(tǒng)啟動(dòng)的后“su -u oracle”仍然沒有結(jié)果。手工執(zhí)行的時(shí)候只有監(jiān)聽無法啟動(dòng)。根據(jù)文檔的提示我把腳本從“/sbin/rc2.d”移動(dòng)到“/etc/rc。config.d”里,在系統(tǒng)啟動(dòng)和關(guān)閉的過程中都有報(bào)錯(cuò):

/sbin/rc[67]: su: not found.
/sbin/rc[67]: su: not found.

stty: : Not a typewriter
.
.
.

stty: : Not a typewriter
有多少個(gè)oeacle進(jìn)程就有多少錯(cuò)誤。
作者: noise    時(shí)間: 2006-09-15 09:43
原帖由 doni 于 2006-9-15 08:39 發(fā)表
HP-UX沒用過,就SOLARIS下的情況而言,有這樣幾點(diǎn)
首先,應(yīng)該注意你的.profile,而不是.dtprofile
其次,自動(dòng)啟動(dòng)和關(guān)閉的腳本可以寫成這樣
su - oracle -c "dbstart; lsnrctl start"
還有就是,啟動(dòng)腳本 ...


oracle的.dtprofile文件內(nèi)容:

# ##########################################################################
# #
# #  .dtprofile
# #
# #  user personal environment variables
# #
# #  Common Desktop Environment (CDE)
# #
# #  (c) Copyright 1996 Digital Equipment Corporation.
# #  (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
# #  (c) Copyright 1993,1994,1996 International Business Machines Corp.
# #  (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
# #  (c) Copyright 1993,1994,1996 Novell, Inc.
# #  (c) Copyright 1996 FUJITSU LIMITED.
# #  (c) Copyright 1996 Hitachi.
# #
# #
# #  $XConsortium: dtprofile.src /main/4 1996/04/21 19:31:50 drk $
# #
# ##########################################################################


# ##########################################################################
# #
# #  Your $HOME/.dtprofile is read each time you login to the Common Desktop
# #  Environment (CDE) and is the place to set or override desktop
# #  environment variables for your session. Environment variables set in
# #  $HOME/.dtprofile are made available to all applications on the desktop.
# #  The desktop will accept either sh or ksh syntax for the commands in
# #  $HOME/.dtprofile.
# #
# ##########################################################################


# ##########################################################################
# #
# #  Random stdout and stderr output from apps started by Session Mgr or
# #  by actions via front panel or workspace menu can be directed into
# #  the user's $HOME/.dt/sessionlogs directory.  By default this output
# #  is not recorded.  Instead it is sent off to /dev/null (Unix's "nothing"
# #  device).
# #
# #  If this random application output is wanted (usually only wanted for
# #  debugging purposes), commenting out following "dtstart_sessionlogfile"
# #  lines will send output to your $HOME/.dt/sessionlogs directory.
# #
# #  Alternatively, can change "/dev/null" to "/dev/console" to see this
# #  debugging output on your console device.  Can start a console via the
# #  Workspace programs menu or via Application Mgr's Desktop Tools
# #  "Terminal Console" icon.
# #
# ##########################################################################

echo "This session log file is currently disabled."  >  $dtstart_sessionlogfile
echo "To enable logging, edit $HOME/.dtprofile and"  >> $dtstart_sessionlogfile
echo "remove dtstart_sessionlogfile=/dev/null line." >> $dtstart_sessionlogfile

export dtstart_sessionlogfile="/dev/null"


# ##########################################################################
# #
# #  By default, the desktop does not read your standard $HOME/.profile
# #  or $HOME/.login files. This can be changed by uncommenting the
# #  DTSOURCEPROFILE variable assignment at the end of this file. The
# #  desktop reads .profile if your $SHELL is "sh" or "ksh", or .login
# #  if your $SHELL is "csh".
# #
# #  The desktop reads the .dtprofile and .profile/.login without an
# #  associated terminal emulator such as xterm or dtterm. This means
# #  there is no available command line for interaction with the user.
# #  This being the case, these scripts must avoid using commands that
# #  depend on having an associated terminal emulator or that interact
# #  with the user. Any messages printed in these scripts will not be
# #  seen when you log in and any prompts such as by the 'read' command
# #  will return an empty string to the script. Commands that set a
# #  terminal state, such as "tset" or "stty" should be avoided.
# #
# #  With minor editing, it is possible to adapt your .profile or .login
# #  for use both with and without the desktop.  Group the statements not
# #  appropriate for your desktop session into one section and enclose them
# #  with an "if" statement that checks for the setting of the "DT"
# #  environment variable. When the desktop reads your .profile or .login
# #  file, it will set "DT" to a non-empty value for which your .profile or
# #  .login can test.
# #
# #  example for sh/ksh
# #
# #    if [ ! "$DT" ]; then
# #      #
# #      # commands and environment variables not appropriate for desktop
# #      #
# #      stty ...
# #   tset ...
# #   DISPLAY=mydisplay:0
# #   ...
# #    fi
# #
# #    #
# #    # environment variables common to both desktop and non-desktop
# #    #
# #    PATH=$HOME/bin:$PATH
# #    MYVAR=value
# #    export MYVAR
# #    ...
# #
# #  example for csh
# #
# #    if ( ! ${?DT} ) then
# #      #
# #      # commands and environment variables not appropriate for desktop
# #      #
# #      stty ...
# #      tset ...
# #      setenv DISPLAY mydisplay:0
# #      ...
# #    endif
# #
# #    #
# #    # environment variables common to both desktop and non-desktop
# #    #
# #    setenv PATH $HOME/bin:$PATH
# #    setenv MYVAR value
# #    ...
# #
# #  Errors in .dtprofile or .profile (.login) may prevent a successful
# #  login. If after you login, your session startup terminates and you
# #  are presented with the login screen, this might be the cause. If this
# #  happens, select the Options->Sessions->Failsafe Session item on the
# #  login screen, login and correct the error. The $HOME/.dt/startlog and
# #  $HOME/.dt/errorlog files may be helpful in identifying errors.
# #
# ##########################################################################

#
#  If $HOME/.profile (.login) has been edited as described above, uncomment
#  the following line.
#
# DTSOURCEPROFILE=true
PATH-$PATH: /user/sbin
TEMP=/tmp
TMPDIR=/tmp
export TEMP TMPDIR
ORACLE_BASSE=/opt/oracle
ORACLE_HOME=/opt/oracle
ORACLE_SID=orcl
ORACLE_TERM=xterm
export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_TERM
NLS_LANG=american_america.ZHS16GB231280
export NLS_LANG
ORA_LNS33=$ORACLE_HOME/ocommon/nls/admin/data
export ORA_LNS33
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/usr/lib:$ORACLE_HOME/RDBMS/lib:$ORACLE_HOME/lib32
SHLIB_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib32
export SHLIB_PATH LD_LIBRARY_PATH
PATH=/bin:/usr/bin:/usr/sbin:/opt/bin:/usr/local/bin:$ORACLE_HOME/bin:/usr/contrib/bin:/$PATH
export PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPAHT:$ORACLE_HOME/network/jlib
export CLASSPATH
EDITOR=vi
export EDITOR
unset TNS_ADMIN
umask 022


紅色部分是在安裝oracle的時(shí)候添加的部分。


root的.profile文件內(nèi)容:

# @(#)B11.23_LR     

# Default (example of) super-user's .profile file


# Do not put "." in PATH; it is a potential security breach.
# Do not put "/usr/local/bin" in PATH; it is a potential security breach.
# Example assumes /home/root exists.
        set +u

        PATH=/usr/sbin:$PATH:/sbin:/home/root:/opt/oracle/bin

# Be sure that VUE does not invoke tty commands

   if [ ! "$VUE" ]; then

   # Set up the terminal:
        if [ "$TERM" = "" ]
        then
                eval ` tset -s -Q -m ':?hp' `
        else
                eval ` tset -s -Q `
        fi
        stty erase "^H" kill "^U" intr "^C" eof "^D"
        stty hupcl ixon ixoff
        tabs

        echo
        echo "Value of TERM has been set to \"$TERM\". "
        export TERM

        EDITOR=vi
        export EDITOR

   fi               # if !VUE


# Set up shell environment:

        set -u                                        # error if undefined variable.
        trap "echo 'logout root'" 0                  # what to do on exit.


# Set up shell variables:

        MAIL=/var/mail/root
        # don't export, so only login shell checks.

        echo "WARNING:  YOU ARE SUPERUSER !!\n"
       
# Set up Oracle

        NLS_LANG=american_america.ZHS16GB231280
        export NLS_LANG
        ORA_LNS33=$ORACLE_HOME/ocommon/nls/admin/data
        export ORA_LNS33
        LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/usr/lib:$ORACLE_HOME/RDBMS/lib:$ORACLE_HOME/lib32
        SHLIB_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib32
        export SHLIB_PATH LD_LIBRARY_PATH
        PATH=/bin:/usr/bin:/usr/sbin:/opt/bin:/usr/local/bin:$ORACLE_HOME/bin:/usr/contrib/bin:/$PATH
        export PATH


最后的紅色部分是我后加的。


另外,我使用的腳本是oracle自帶的啟動(dòng)和關(guān)閉腳本,啟動(dòng)啟動(dòng)腳本已經(jīng)包括了監(jiān)聽啟動(dòng)部分。

[ 本帖最后由 noise 于 2006-9-15 11:16 編輯 ]
作者: blue_stone    時(shí)間: 2006-09-15 10:00
你使用了oracle提供的dbstart腳本,  這個(gè)腳本會(huì)去檢測/etc/oratab, 并根據(jù)oratab的內(nèi)容啟動(dòng)相應(yīng)的oracle數(shù)據(jù)庫實(shí)例, 如果以oracle用戶登錄后運(yùn)行dbstart, 則不會(huì)運(yùn)行你添加的環(huán)境變量的內(nèi)容, 因?yàn)榇藭r(shí)$PATH環(huán)境變量不為空。

關(guān)于監(jiān)聽的問題, 建議用如下腳本啟動(dòng)
ORACLE_HOME=
export ORACLE_HOME
$ORACLE_HOME/bin/lsnrctl start

運(yùn)行dbstart和dbstop,你的數(shù)據(jù)庫能夠正常啟動(dòng)關(guān)閉么?
作者: noise    時(shí)間: 2006-09-15 10:10
手工運(yùn)行su - oracle -c "dbstart"和su - oracle -c "dbshut"可以實(shí)現(xiàn)數(shù)據(jù)庫的啟動(dòng)和關(guān)閉,只是監(jiān)聽不能正常啟動(dòng),還報(bào)錯(cuò)。
作者: doni    時(shí)間: 2006-09-15 10:28
查一下監(jiān)聽的配置文件
作者: blue_stone    時(shí)間: 2006-09-15 10:29
換一下啟動(dòng)監(jiān)聽的部分, 看看監(jiān)聽能否正常啟動(dòng)。
作者: blue_stone    時(shí)間: 2006-09-15 10:31
你說su - oracle不可以做一些事情, 直接用oracle登錄可以做一些事情
可不可以給出su - oracle后的環(huán)境變量和直接用oracle登錄后的環(huán)境變量
作者: noise    時(shí)間: 2006-09-15 10:34
監(jiān)聽無法啟動(dòng)的原因找到了,是在oracle下少了個(gè).profile。
作者: noise    時(shí)間: 2006-09-15 11:52
我現(xiàn)在試過,把腳本放在/sbin/rc2.d、/sbin/rc3.d、/sbin/rc4.d和/etc/rc.config.d中,只有在/etc/rc.config.d中可以在啟動(dòng)時(shí)執(zhí)行腳本,但這樣會(huì)導(dǎo)致系統(tǒng)啟動(dòng)變得非常慢,這是什么原因?腳本還可以放在什么位置?而且不影響系統(tǒng)的正常啟動(dòng)速度?
作者: numenhuang    時(shí)間: 2006-09-15 12:48
http://docs.hp.com/zh_cn/B2355-90954/ch05s03.html
作者: blue_stone    時(shí)間: 2006-09-15 12:54
HP-UX的默認(rèn)運(yùn)行級(jí)別是3, 啟動(dòng)過程中將運(yùn)行/sbin/rc3.d下的所有腳本,不過不是以start作為參數(shù)來運(yùn)行這個(gè)腳本(和linux不太一樣), 如果init 2然后再init 3則會(huì)以start參數(shù)來運(yùn)行所有腳本
作者: noise    時(shí)間: 2006-09-15 14:59
原帖由 blue_stone 于 2006-9-15 12:54 發(fā)表
HP-UX的默認(rèn)運(yùn)行級(jí)別是3, 啟動(dòng)過程中將運(yùn)行/sbin/rc3.d下的所有腳本,不過不是以start作為參數(shù)來運(yùn)行這個(gè)腳本(和linux不太一樣), 如果init 2然后再init 3則會(huì)以start參數(shù)來運(yùn)行所有腳本


沒看明白,我這樣寫對(duì)不對(duì):


守護(hù)程序,/etc/rc.config.d/Oracle:

#!/sbin/sh#
# Oracle startup/shutdown Config
# Oracle:        Set to 1 Start Oracle10g
# OracleHome:        home dir for Oracle
#

Oracle=1
oracleHome=/opt/oracle/bin


啟動(dòng)腳本,/sbin/init.d/Oracle:

#!/sbin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/opt/oracle/bin
export PAHT

rval=0

case Oracle in
'start_msg')
        # Emit a _short_ message relating to running this script with
        # the "start" argument; this message appears as part of the checklist.
        echo "Starting the Oracle 10g"
        ;;

'stop_msg')
        # Emit a _short_ message relating to running this script with
        # the "stop" argument; this message appears as part of the checklist.
        echo "Stopping the Oracle 10g"
        ;;

'start')

        # source the system configuration variables
        if [ -f /etc/rc.config.d/Oracle ] ; then
                . /etc/rc.config.d/Oracle
        else
                echo "ERROR: /etc/rc.config.d/Oracle file MISSING"
        fi

        # Check to see if this script is allowed to run...
        if [ "$Oracle" != 1 ]; then su - oracle -c "/opt/oracle/bin/dbstart"
                rval=2
        else

        # Execute the commands to start your subsystem
        :
        fi
        ;;

'stop')
        # source the system configuration variables
        if [ -f /etc/rc.config.d/Oracle ] ; then
                . /etc/rc.config.d/Oracle
        else
                echo "ERROR: /etc/rc.config.d/Oracle file MISSING"
        fi

        # Check to see if this script is allowed to run...
        if [ "$Oracle" != 1 ]; then su - oracle -c "/opt/oracle/bin/dbshut"
                rval=2
        else
        :
        # Execute the commands to stop your subsystem

        fi
        ;;

*)
        echo "usage: $0 {start|stop|start_msg|stop_msg}"
        rval=1
        ;;
esac

exit $rval

[ 本帖最后由 noise 于 2006-9-15 15:23 編輯 ]
作者: noise    時(shí)間: 2006-09-15 15:21
/sbin/rc3.d/S999Oracle start和/sbin/rc2.d/K100Oracle stop都測試通過了,重新啟動(dòng)試一下應(yīng)該就是他了。
作者: noise    時(shí)間: 2006-09-15 15:25
感謝各位的幫忙,數(shù)據(jù)庫可以正常啟動(dòng)和關(guān)閉了。
作者: voidmine    時(shí)間: 2007-03-07 14:37
'start')
       # source the system configuration variables
        if [ -f /etc/rc.config.d/Oracle ] ; then
                . /etc/rc.config.d/Oracle
        else
                echo "ERROR: /etc/rc.config.d/Oracle file MISSING"
        fi

        # Check to see if this script is allowed to run...
        if [ "$Oracle" != 1 ]; then su - oracle -c "/opt/oracle/bin/dbstart"
                rval=2
        else


在 /etc/rc.config.d/Oracle  中設(shè)置的是Oracle=1時(shí),才啟動(dòng)dbstart,
但代碼中卻是 "$Oracle" 不等于1 時(shí),啟動(dòng)dbstart ?? 為什么???




歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2