佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > Shell實(shí)現(xiàn)的Oracle啟動(dòng)腳本分享

Shell實(shí)現(xiàn)的Oracle啟動(dòng)腳本分享

熱門標(biāo)簽:呼叫中心市場需求 地方門戶網(wǎng)站 鐵路電話系統(tǒng) AI電銷 百度競價(jià)排名 網(wǎng)站排名優(yōu)化 Linux服務(wù)器 服務(wù)外包

Usage: sh oracled [start|stop|restart] SIDs 其中SIDs是數(shù)據(jù)庫名,多個(gè)名稱之間用逗號(hào)分隔。缺省的操作是 restart ,也可以指定需要進(jìn)行的操作( start | stop | restart )

復(fù)制代碼 代碼如下:

#!/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環(huán)境下編寫shell腳本實(shí)現(xiàn)啟動(dòng)停止tomcat服務(wù)的方法
  • Linux啟動(dòng)jar包的shell腳本
  • 用shell腳本監(jiān)控進(jìn)程是否存在 不存在則啟動(dòng)的實(shí)例
  • Shell實(shí)現(xiàn)判斷進(jìn)程是否存在并重新啟動(dòng)腳本分享
  • CentOS下redis自啟動(dòng)shell腳本
  • 如何利用shell開發(fā)keepalived啟動(dòng)腳本

標(biāo)簽:黃山 衡水 湘潭 仙桃 湖南 銅川 崇左 蘭州

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Shell實(shí)現(xiàn)的Oracle啟動(dòng)腳本分享》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    苗栗市| 景谷| 南充市| 科技| 衢州市| 松阳县| 偏关县| 文昌市| 新乡县| 和平区| 广东省| 保山市| 张北县| 长乐市| 宕昌县| 佛教| 平阳县| 建水县| 邵武市| 延寿县| 新绛县| 廉江市| 普兰县| 东阳市| 介休市| 蓝田县| 星座| 中西区| 梧州市| 伊春市| 永吉县| 萨嘎县| 秦安县| 龙口市| 潍坊市| 五华县| 莱州市| 庆元县| 东台市| 锡林浩特市| 翁牛特旗|