Welcome 微信登录

首页 / 数据库 / MySQL / Linux/Unix 中如何配置 Oracle Database 随服务器自动启动

Oracle Database 软件提供了以下两个脚本来配置数据库随服务器自动启动和关闭:
 [oracle@prod bin]$ pwd
 /u01/app/oracle/product/11.2.0/db_1/bin
 [oracle@prod bin]$ ls -l dbs*
 -rwxr-x--- 1 oracle oinstall  6030 Jan  1  2000 dbshut
 -rwxr-x--- 1 oracle oinstall 13797 Jan  1  2000 dbstart
 我们需要在 unix 启动/关闭脚本( rc0.d / rc1.d 等)中调用这两个脚本
 
1、检查 /etc/oratab 下的 oratab 文件,该文件应该包含要设置自动启动和关闭的数据库的条目,
 其中 autostart 值域的值为 Y,如下所示:
 $ORACLE_SID:$ORACLE_HOME:Y
 
[oracle@prod bin]$ more /etc/oratab
 prod:/u01/app/oracle/product/11.2.0/db_1:N
 
[oracle@prod bin]$ vi /etc/oratab
 prod:/u01/app/oracle/product/11.2.0/db_1:Y
 
2、将如下文件保存到 /etc/init.d/ 下(/etc/init.d/ 是 RedHat linux 下特有的)。
 
[root@prod init.d]# pwd
 /etc/init.d
 [root@prod init.d]# ls -l dbora
 -rw-r--r-- 1 root root 1049 Mar 27 20:10 dbora
 --注意 ORA_OWNER 和 ORA_HOME 变量的设置
 
------------------ Start dbora ---------------------------------
 
#! /bin/bash
 #
 # description: Oracle auto start-stop script.
 #
 # chkconfig: 2345 99 10
 #
 # processname: oracle
 # config: /etc/oratab
 # pidfile: /var/run/oracle.pid
 
# Source function library.
 . /etc/init.d/functions
 
RETVAL=0
 ORA_OWNER="oracle"
 ORA_HOME="/u01/app/oracle/product/11.2.0/db_1"
 
# See how we were called.
 
prog="oracle"
 
start() {
 echo -n $"Starting $prog: "
 su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
 su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
 RETVAL=$?
 echo
 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dbora
 
return $RETVAL
 }
 
stop() {
 echo -n $"Stopping $prog: "
 su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
 su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
 RETVAL=$?
 echo
 [ $RETVAL -eq 0 ] && rm -r /var/lock/subsys/dbora
 
return $RETVAL
 }
 
restart() {
 stop
 start
 }
 
case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 restart)
 restart
 ;;
 *)
 echo $"Usage: $0 {start|stop|restart}"
 exit 1
 esac
 
exit $?
 
------------------ End dbora ---------------------------------
  • 1
  • 2
  • 下一页
MySQL Thread pool 操作过程Oracle 高水位线详解相关资讯      Oracle Database  Oracle自动启动 
  • Oracle 最简单的随系统自动启动  (10/03/2014 09:25:03)
  • 单节点服务器安装Oracle Grid   (05/12/2014 19:44:48)
  • Oracle Database 中 B*Tree 索引内  (12/28/2012 08:18:10)
  • Oracle Database and Instance简介  (09/26/2014 19:39:07)
  • Oracle 中关于database的read only  (09/07/2013 10:31:33)
  • Oracle随Linux自动启动的方法  (12/15/2012 09:28:20)
本文评论 查看全部评论 (0)
表情: 姓名: 字数