linux下启动oracle数据库实例的脚本
2008-05-12 13:57
465 查看
来源:http://jaryer.blog.sohu.com/41567121.html
#!/bin/sh
cmdname="restart"
# get oracle sid information from env by default.
oracleSID=${ORACLE_SID}
env_oracleSID=${ORACLE_SID}
function echohelp(){
echo "******oracled Tool Helper******"
echo "Usage:sh oracled [start|stop|restart] SIDs"
echo "SIDs : seperated by comma"
exit 5
}
function startoracle(){
echo "begin to start oracle ..."
lsnrctl start
for curSID in `echo ${oracleSID} | awk 'BEGIN {RS=","}{ORS="/n"}{print $1}'` ; do
if [ "x${curSID}" = "x" ] ; then
continue;
fi
export ORACLE_SID=${curSID}
sqlplus /nolog <<EOF
connect /as sysdba
startup
exit
exit
EOF
echo "oracle DB [${curSID}] started OK."
done
}
function stoporacle(){
echo "begin to stop oracle ..."
for curSID in `echo ${oracleSID} | awk 'BEGIN {RS=","}{ORS="/n"}{print $1}'` ; do
if [ "x${curSID}" = "x" ] ; then
continue;
fi
export ORACLE_SID=${curSID}
sqlplus /nolog <<EOF
connect /as sysdba
shutdown immediate
exit
exit
EOF
echo "oracle DB [${curSID}] stopped OK."
done
lsnrctl stop
}
function restartoracle(){
stoporacle
startoracle
}
if [ $# -lt 1 ] ; then
echohelp
fi
until [ $# -eq 0 ]
do
tmpVOrg=$1
tmpV=`echo "${tmpVOrg}" | awk '{printf "%s",$1}' | tr '[A-Z]' '[a-z]'`
if [ $tmpV = "start" -o $tmpV = "restart" -o $tmpV = "stop" ] ; then
cmdname=${tmpV}
elif [ $tmpV = "--help" -o $tmpV = "-h" ] ; then
echohelp
else
oracleSID=$tmpVOrg
fi
shift
done
if [ "x${cmdname}" = "x" ] ; then
echohelp
fi
${cmdname}oracle
export ORACLE_SID=${env_oracleSID}
#!/bin/sh
cmdname="restart"
# get oracle sid information from env by default.
oracleSID=${ORACLE_SID}
env_oracleSID=${ORACLE_SID}
function echohelp(){
echo "******oracled Tool Helper******"
echo "Usage:sh oracled [start|stop|restart] SIDs"
echo "SIDs : seperated by comma"
exit 5
}
function startoracle(){
echo "begin to start oracle ..."
lsnrctl start
for curSID in `echo ${oracleSID} | awk 'BEGIN {RS=","}{ORS="/n"}{print $1}'` ; do
if [ "x${curSID}" = "x" ] ; then
continue;
fi
export ORACLE_SID=${curSID}
sqlplus /nolog <<EOF
connect /as sysdba
startup
exit
exit
EOF
echo "oracle DB [${curSID}] started OK."
done
}
function stoporacle(){
echo "begin to stop oracle ..."
for curSID in `echo ${oracleSID} | awk 'BEGIN {RS=","}{ORS="/n"}{print $1}'` ; do
if [ "x${curSID}" = "x" ] ; then
continue;
fi
export ORACLE_SID=${curSID}
sqlplus /nolog <<EOF
connect /as sysdba
shutdown immediate
exit
exit
EOF
echo "oracle DB [${curSID}] stopped OK."
done
lsnrctl stop
}
function restartoracle(){
stoporacle
startoracle
}
if [ $# -lt 1 ] ; then
echohelp
fi
until [ $# -eq 0 ]
do
tmpVOrg=$1
tmpV=`echo "${tmpVOrg}" | awk '{printf "%s",$1}' | tr '[A-Z]' '[a-z]'`
if [ $tmpV = "start" -o $tmpV = "restart" -o $tmpV = "stop" ] ; then
cmdname=${tmpV}
elif [ $tmpV = "--help" -o $tmpV = "-h" ] ; then
echohelp
else
oracleSID=$tmpVOrg
fi
shift
done
if [ "x${cmdname}" = "x" ] ; then
echohelp
fi
${cmdname}oracle
export ORACLE_SID=${env_oracleSID}
相关文章推荐
- Linux/UNIX环境下Oracle数据库多实例开机启动脚本(转)
- Linux/UNIX环境下Oracle数据库多实例开机启动脚本
- Linux——oracle数据库实例启动关闭(转)
- Linux主机名配置与Oracle配置文件不相符,导致oracle数据库实例无法启动
- linux下删除oracle数据库实例
- linux开机启动脚本的顺序
- 详细讲解Linux启动流程及启动用到的配置文件及脚本
- Linux下开机启动脚本 etc rcS 环境变量 pid判断
- linux开机自动启动脚本
- linux、shell脚本实例一“查找一个文件或者目录 找到了提示 没找到则输出未找到”
- linux 开机自动启动脚本方法
- Linux下 SVN +Apache+SSL配置手册+apache自动启动脚本 --写给菜鸟的详细配置
- linux下怎么启动oracle数据库,命令是什么?
- Linux平台Oracle多个实例启动说明
- Linux Oracle服务启动&停止脚本与开机自启动
- 详解Linux系统中Oracle数据库程序的启动和关闭方式
- 详解Linux系统中Oracle数据库程序的启动和关闭方式
- Linux系统开机自动启动脚本。自动加载某些脚本或系统服务
- linux 环境下实现某项服务(脚本等也可)的开机延迟启动
- Oracle数据库的启动和关闭顺序实例讲解