注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

zjc的博客

技术积累

 
 
 

日志

 
 

suse下oracle 数据库自动启动配置  

2009-01-09 14:14:34|  分类: oracle管理 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

操作系suse9 enterprise ,数据库oracle10g

1。建立suse自动启动服务

   (1)在/etc/init.d/目录下新建脚本df_soft,,内容如下

#! /bin/sh
# Copyright (c) 2009--2010 DEEFEI .
#
# Author: ZJC <zjcdillion@163.com>, 2009-2010
#
# /etc/init.d/df_soft
#
#   and symbolic its link
#
# /usr/sbin/rcdf_soft
#
# System startup script for the df_soft
#
### BEGIN INIT INFO
# Provides:       df_soft
# Required-Start: $network $splash_late
# Default-Start:  3 5
# Default-Stop: 
# Description:    df_soft job service
### END INIT INFO

# Source SuSE config
. /etc/rc.status
#sleep 20
DFSOFT_BIN=/usr/local/bin/df_oracle_start.sh
test -x $DFSOFT_BIN || { echo "Nor /usr/local/bin/df_oracle_start.sh  exists"; rc_failed 5; rc_status -v; rc_exit; }

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num><num>
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
. /etc/rc.status
echo "RC status@@@@"
# First reset status of this service
rc_reset
echo "RC reset@@@@"
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

case "$1" in
    start)
 echo -n "Starting DFDATABASE "
 ## Start daemon with startproc(8). If this fails
 ## the echo return value is set appropriate.

 # NOTE: startproc return 0, even if service is
 # already running to match LSB spec.
 $DFSOFT_BIN

 # Remember status and be verbose
 rc_status -v
 ;;
    stop)
 echo -n "Shutting down DFSOFT"
 ## Stop daemon with killproc(8) and if this fails
 ## set echo the echo return value.

 # Remember status and be verbose
 rc_status -v
 ;;
    try-restart)
 ## Stop the service and if this succeeds (i.e. the
 ## service was running before), start it again.
 ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
 $0 status >/dev/null &&  $0 restart

 # Remember status and be quiet
 rc_status
 ;;
    restart)
 ## Stop the service and regardless of whether it was
 ## running or not, start it again.
 $0 stop
 $0 start

 # Remember status and be quiet
 rc_status
 ;;
    force-reload)
 ## Signal the daemon to reload its config. Most daemons
 ## do this on signal 1 (SIGHUP).
 ## If it does not support it, restart.

 echo -n "Reload service Cron"
 ## if it supports it:
        ## cron monitors /etc/crontab  anyway
 
 #checkproc $DFSOFT_BIN
 #rc_status -v

 ## Otherwise:
 #$0 stop  &&  $0 start
 #rc_status
 ;;
    reload)
 ## Like force-reload, but if daemon does not support
 ## signalling, do nothing (!)

 ## Otherwise if it does not support reload:
 rc_status -v
 ;;
    status)
 echo -n "Checking for DFSOFT: "
 ## Check status with checkproc(8), if process is running
 ## checkproc will return with exit status 0.

 # Status has a slightly different for the status command:
 # 0 - service running
 # 1 - service dead, but /var/run/  pid  file exists
 # 2 - service dead, but /var/lock/ lock file exists
 # 3 - service not running

 # NOTE: checkproc returns LSB compliant status values.
 #checkproc $DFSOFT_BIN
 rc_status -v
 ;;
    probe)
 ## Optional: Probe for the necessity of a reload,
 ## give out the argument which is required for a reload.

 ;;
    *)
 echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
 exit 1
 ;;
esac
rc_exit

   (2)将启动脚本加入系统,执行命令:

           chkconfig -level 35 df_soft

           chkconfig -level 35 df_soft on

    (3)在/usr//local/bin/目录下创建脚本df_oracle_start.sh与oracle_start.sql,内容如下:

df_oracle_start.sh

#!/bin/sh:

#zjcdillion@163.com
su oracle -lc "/opt/oracle/product/10.2.0/db_1/bin/lsnrctl start"
su oracle -lc "/opt/oracle/product/10.2.0/db_1/bin/sqlplus -s /nolog @/usr/local/bin/oracle_start.sql"

oracle_start.sql:

CONNECT sys/passwd as sysdba;
startup;
commit;
quit;

     (4)创建链接,执行命令:

            ln -s /etc/init.d/df_soft /usr/sbin/rcdf_soft

2。在实际使用中请根据数据库的具体配置来修改相应脚本。


  评论这张
 
阅读(975)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017