Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2775134
  • 博文数量: 389
  • 博客积分: 4177
  • 博客等级: 上校
  • 技术积分: 4773
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-16 23:29
文章分类

全部博文(389)

分类: Oracle

2011-05-29 17:32:06

Oracle Maintaince Script
      All the times ,I think that I may be write an Oracle Maintaince Script with all functions.I think times and again.As a result,only a few functions that I can write.The script is  displayed as fllowings;
#!/bin/bash
menu(){
echo  "             Oracle Database Menu"
echo "          1, Start oracle database"
echo "          2, Stop oracle database"
echo "          3, Start Oracle Enterpris Manager"
echo "          4, Quit"
}
if [ $# -gt 0 ]
   then
 echo "Execute scritpt with no parameters"
 exit;
fi
while true
do
menu
echo -n "Enter Your Choice:"
read e
case $e in
  1)
  echo "start"
  su oracle -c '/u01/oracle/product/11.2/bin/dbstart /u01/oracle/product/11.2'
  clear
 ;;
  2)
  echo "stop"
  su oracle -c '/u01/oracle/product/11.2/bin/dbshut /u01/oracle/product/11.2'
  clear
  ;;
  3)
  su oracle -c '/u01/oracle/product/11.2/bin/emctl start dbconsole'
  clear
 ;;
  4)
   echo -n "Continue quit(y/n):"
    read c
     case $c in
      n|N|no)
       continue
       ;;
      y|Y|yes)
       break
      ;;
      *)
      break
     ;;
     esac     
  ;;
esac
done
   This scripts suits employee who don't know how to start/stop oracle database. You can add function entry as you need.
NOTE:AT FIRST CHANGE /etc/oratab
阅读(1732) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~