#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# description: Startup/Shutdown Oracle listener and instance
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/lsnrctl -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- start, stop, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
$ORACLE_HOME/bin/lsnrctl start
sqlplus /nolog<<EOF
connect / as sysdba
startup
quit
EOF
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
$ORACLE_HOME/bin/lsnrctl stop
sqlplus /nolog<<EOF
connect / as sysdba
shutdown immediate
quit
EOF
echo "OK"
本文介绍了一个用于启动和关闭Oracle实例及监听器的bash脚本。该脚本首先检查Oracle环境变量设置是否正确,然后根据传入的参数启动或关闭Oracle服务。支持的参数包括启动(start)、关闭(stop)和重启(restart)。
879

被折叠的 条评论
为什么被折叠?



