国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > Linux > 正文

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

2019-10-26 18:45:00
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

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

代碼如下:
#!/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 

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 贡嘎县| 喀什市| 湾仔区| 唐海县| 六枝特区| 皋兰县| 南通市| 万载县| 光山县| 定西市| 肇源县| 聂拉木县| 抚宁县| 嘉定区| 嘉黎县| 蓬溪县| 崇左市| 正阳县| 九江县| 琼海市| 南通市| 双鸭山市| 来宾市| 永仁县| 团风县| 清水县| 铜山县| 宁武县| 阿拉善左旗| 淳安县| 朝阳县| 北宁市| 赤峰市| 英山县| 江口县| 云南省| 沿河| 浙江省| 申扎县| 鹰潭市| 关岭|