Oracle8.1.7在IBM-AIX4.3上的自动启动和关闭

数据库:Oracle 8.1.7
操作系统:IBM-AIX 4.3.3

需要脚本如下:

1./rdbm/orasrv/orasrv

#!/bin/ksh

usage=" Usage: orasrv [START | STOP]"
if test $# -ne 1
then
     echo "$usage"
     exit 1
elif test $1 = START
then
echo  "--------------------------------------------------------------

                  Now start oracle database server ... ...

--------------------------------------------------------------"

echo /
"connect internal
startup
quit"|svrmgrl

elif test $1 = STOP
then
echo  "--------------------------------------------------------------

                  Now stop oracle database server ... ...

--------------------------------------------------------------"

echo /
"connect internal
shutdown immediate
quit"|svrmgrl
else
        echo "$usage"
        exit 1
fi

2. /rdbm/orasrv/.kshrc (环境变量,不是必须的)
# .kshrc
# This file is executed by the ksh shell at startup, after .profile.
# Set the command line editing to be in emacs style.

set -o emacs

# Set the trackall option.
# Turn on command tracking (build working set of commands).

set -o trackall

# Let control-d logout

set +o ignoreeof

# Background job run at low priority.

set -o bgnice

# All variables set are set with the export attribute.
# "export VARIABLE" is not needed.

set -o allexport

# Aliases.

. ~/.ksh_alias

# function definitions

. ~/.ksh_fxns

3. /rdbm/orasrv/.ksh_fxns (环境变量,不是必须的)

#!/bin/ksh
###############################################################################
#
# Usage  : This file defines a Korn shell functions
#
###############################################################################
#
# ---------- Set temporary prompt variable to the command number
#            followd by a colon
PS0="`hostname`:"
#
#------------------------------------------------------------------------------
# -- Define Korn Shell Functions
#------------------------------------------------------------------------------
#
# ---------- Function _cd
#            - changes directories, then set the command
#              prompt to: "command-number:pathname> "
function _dir {
 if (($# == 0))
 then
   'ls' -lrt
 elif (($# == 1))
 then
   'ls' $1
 fi
}

alias -x dir=_dir
typeset -fx _dir

function _cd {
   if (($# == 0))
   then
      'cd'
      PS1="$PS0$PWD> "
   elif (($# == 1))
   then
      'cd' $1
      PS1="$PS0$PWD> "
   elif (($# == 2))
   then
      'cd' $1 $2
      PS1="$PS0$PWD> "
   fi
}
#
# ---------- alias the cd command to the _cd function
#            and Export the _cd function
alias -x cd=_cd
typeset -fx _cd
#
# ---------- Function _bmake
#            - Run make in the background, writing all output to
#              a file called bmakerr in current directory
function _bmake {
   if (($# == 0))
   then
      nohup make 2>|$PWD/bmakerr 1>&2 &
   elif (($# == 1))
   then
      nohup make $1 2>|$PWD/bmakerr 1>&2 &
   elif (($# > 1))
   then
      echo 'Usage: bmake [target]'
   fi
}
#
# ---------- alias the bmake command to the _bmake function
#            and Export the _bmake function
alias -x bmake=_bmake
typeset -fx _bmake
#
#
# ---------- Function _bgm
#            - Run gm in the background, writing all output to
#              a file called bgmerr in current directory
function _bgm {
   if (($# == 0))
   then
#      nohup gm 2>|$PWD/bgmerr 1>&2 &
      nohup gm --no-cm>> bgmerr 2>&1 &
   elif (($# > 0))
   then
      echo 'Usage: bgm'
   fi
}
#
# ---------- alias the bgm command to the _bgm function
#            and Export the _bgm function
alias -x bgm=_bgm
typeset -fx _bgm
#
#
# ---------- Function _vib
#            - First backup all existing files on the command line.
#              The backup file(s) created have the same name, but
#              with a ~ appended to the filename.
#              NOTE: backups will be made only if you are able to write
#                    in the current directory
#            - Then invoke vi to edit all files.
function _vib {
   if (($# == 0))
   then
      'vi'
   elif (($# < 0))
   then
      echo 'Usage: e [filename list]'
   else
      for FILE in $*
      do
  if ( [[ -a $FILE ]] )
  then
     [[ -a $FILE~ && (-r $FILE~ || (! -w $FILE~)) ]] && rm -f $FILE~
     cp $FILE $FILE~
     chmod 664 $FILE~
  fi
      done
      'vi' $*
   fi
}
#
# ---------- alias the vi command to the _vib function
#            and Export the _vib function
#alias -x vi=_vib
#typeset -fx _vib


4. /rdbm/orasrv/.ksh_alias (环境变量,不是必须的)

5. /etc/rc.startdb

echo "Starting Oracle 8.1.7 Database Sever ..........."
su - orasrv -c "orasrv START"
su - orasrv -c "lsnrctl start"
echo "Startup of Oracle completed !!! "

6. /etc/rc.stopdb
echo "Stoping Oracle 8.1.7 Database Sever ..........."
su - orasrv -c "orasrv STOP"
su - orasrv -c "lsnrctl stop"
echo "Stop of Oracle completed !!! "

7./etc/rc.shutdown (系统自动执行,不用担心)
#!/bin/ksh
/etc/rc.stopdb

8.需要在/etc/inittab文件中最后加入一行,实现数据库开机自启动

startdb:2345678:wait:/etc/rc.startdb

需要注意的是,以上脚本都应有执行权限。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值