Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1151279
  • 博文数量: 150
  • 博客积分: 2739
  • 博客等级: 少校
  • 技术积分: 2392
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-07 12:28
文章分类

全部博文(150)

文章存档

2015年(2)

2014年(16)

2013年(10)

2012年(58)

2011年(64)

分类:

2012-01-28 11:13:33

原文地址:oracle启动脚本 作者:syxian

1.修改oratab,因为我们需要使用dbstart utility
  1. [root@ora01 ~]# vi /etc/oratab
  2. orcl:/u01/app/oracle/product/10.2.0/db_1:Y
2.修改启动文件/u01/app/oracle/product/10.2.0/db_1/bin/dbstart
  1. 78 ORACLE_HOME_LISTNER=/u01/app/oracle/product/10.2.0/db_1/
3.增加启动脚本touch /etc/init.d/oracle;chmod +x /etc/init.d/oracle
  1. #!/bin/bash
  2. #/etc/init.d/oracle chmod +x oracle
  3. # oracle This shell script takes care of starting and stopping
  4. # the MySQL subsystem (mysqld).
  5. # chkconfig: - 90 10
  6. # description: Oracle database server.
  7. # processname: oracle
  8. ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
  9. ORA_OWNER=oracle

  10. prog="Oracle"

  11. # Source function library.
  12. . /etc/rc.d/init.d/functions

  13. if [ ! -f $ORA_HOME/bin/dbstart ]
  14. then
  15. echo "Oracle startup: cannot start"
  16. exit
  17. fi

  18. start(){
  19. su - $ORA_OWNER -c $ORA_HOME/bin/dbstart >/dev/null 2>&1 &
  20. ret=$?
  21. if [ $ret -eq 0 ]; then
  22. action $"Starting $prog: " /bin/true
  23. else
  24. action $"Starting $prog: " /bin/false
  25. fi
  26. [ $ret -eq 0 ] && touch /var/lock/subsys/oracled
  27. return $ret
  28. }

  29. stop(){
  30. su - $ORA_OWNER -c $ORA_HOME/bin/dbshut >/dev/null 2>&1
  31. ret=$?
  32. if [ $ret -eq 0 ]; then
  33. action $"Stopping $prog: " /bin/true
  34. else
  35. action $"Stopping $prog: " /bin/false
  36. fi
  37. [ $ret -eq 0 ] && rm -f /var/lock/subsys/oracled
  38. return $ret
  39. }
  40. restart(){
  41. stop
  42. start

  43. }
  44. # See how we were called.
  45. case "$1" in
  46. start)
  47. start
  48. ;;
  49. stop)
  50. stop
  51. ;;
  52. restart)
  53. restart
  54. ;;
  55. condrestart)
  56. condrestart
  57. ;;
  58. *)
  59. echo $"Usage: $0 {start|stop|restart}"
  60. exit 1
  61. esac
4.以root用户启动关闭oracle
  1. [root@ora01 ~]# /etc/init.d/oracle start
  2. [root@ora01 ~]# /etc/init.d/oracle stop

在使用drbd,heartbeat做HA时可以将listener和数据库启动分开。



阅读(1164) | 评论(0) | 转发(0) |
0

上一篇:Linux设备驱动入门(一)

下一篇:Opsview安装

给主人留下些什么吧!~~