<b>Linx </b><b>下</b><b>oracle </b><b>数据库启动停止脚本程序</b>
<b>说明</b>:linux下oracle 数据库涉及切换用户,又要执行命令中参数可以参考如下格式:
su – oracle – c "sqlplus '/ as sysdba'"<<!
startup
exit
!
或者
su – oracle –c "sqlplus '/ as sysdba' << !
startup
! "
或者------10G或者以后版本可以省略sqlplus 后面引号,即:
su – oracle – c "sqlplus / as sysdba" <<!
##############Oracle 不同版本启动数据库命令###########
#!/bin/sh
ORACLE_SID=$1
LISTENER=$2
export ORACLE_SID
# The nether lines for Oracle Version 9 or Later
su - oracle -c "sqlplus '/ as sysdba'"<<!
# The nether lines for Oracle Version 8 or Older
su - oracle -c "svrmgrl" <<!
connect internal
# start Oracle listener
lsnrctl start $LISTENER
##############Oracle 不同版本强制停止命令汇总###########
export ORACLE_SID=$1
#Kill Oracle Listener
LSNR_PID=`ps -ef| grep tnslsnr|grep $LISTENER|grep -v grep|awk -F" " '{print $2}'`
if [ EMPTY"$LSNR_PID = EMPTY ]
then
echo "Not found listener process <tnslsnr>!"
else
echo "Kill oracle listener process <"$LSNR_PID">."
kill -9 $LSNR_PID
fi
#The nether lines for Oracle Version 9 or Later
su - oracle -c "sqlplus '/ as sysdba'" <<!
shutdown abort
#The nether lines for Oracle Version 8 or older
##############Oracle 不同版本正常停止###########
# stop Oracle listener
lsnrctl stop $LISTENER
shutdown immediate
su - oracle -c "svrmgrl "<<!
附加:
<b>附加</b><b>:</b><b>su – oracle –c "sqlplus '/ as sysdba'" <<!</b>
<b>host sleep 5;</b>
<b>execute dbms_lock.sleep(5);</b>
<b></b>
<b>shutdown immediate;</b>
<b>exit!</b>