Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3098591
  • 博文数量: 710
  • 博客积分: 14546
  • 博客等级: 上将
  • 技术积分: 6738
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-30 10:20
文章分类

全部博文(710)

文章存档

2016年(1)

2014年(7)

2013年(22)

2012年(227)

2011年(322)

2009年(119)

2008年(12)

分类: Oracle

2012-01-13 18:09:28

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和数据库启动分开。



阅读(2337) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~