ORALCE開機自啟動

ORALCE開機自啟動

方法1

利用/etc/oratab文件。這個文件由root.sh創建,DBCA建庫時更新。

如果想用$ORACLE_HOME/bin/dbstart脚本来启动数据库實例,则需要将/etc/oratab文件中相应項置为Y。简单的说就是dbstart脚本根据oratab文件中的配置决定启动哪几个實例。

 

$vi /etc/oratab

 

# This file is used by ORACLE utilities. It is created by root.sh

# and updated by the Database Configuration Assistant when creating

# a database.

 

# A colon, ':', is used as the field terminator. A new line terminates

# the entry. Lines beginning with a pound sign, '#', are comments.

#

# Entries are of the form.:

#  $ORACLE_SID:$ORACLE_HOME::

#

# The first and second fields are the system identifier and home

# directory of the database respectively. The third filed indicates

# to the dbstart utility that the database should , "Y", or should not,

# "N", be brought up at system boot time.

#

# Multiple entries with the same $ORACLE_SID are not allowed.

#

#

# *:/u01/product/oracle:N

dell:/u01/product/oracle:Y

 

然後在/etc/rc.d/init.d下创建啟動脚本startdb

$vi startdb

 

#!/bin/sh

ORACLE_HOME=/u01/product/oracle

ORACLE _OWNER=oracle

if [ ! -f $ORACLE _HOME/bin/dbstart ]

then

 echo "Oracle startup: cannot start"

 exit

fi

case "$1" in

 'start')

    su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbstart &

    su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"

 ;;

 'stop')

    su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"

    su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut $

 ;;

esac

 

修改/etc/rc.d/init.d/startdb的属性为755

chmod 755 /etc/rc.d/init.d/startdb

 

创建不同级别的link文件。

$   ln   -s   /etc/rc.d/init.d/startdb /etc/rc.d/rc3.d/S99startdb
$   ln   -s   /etc/rc.d/init.d/startdb /etc/rc.d/rc5.d/S99startdb

$   ln   -s   /etc/rc.d/init.d/startdb /etc/rc.d/rc6.d/S99startdb
$   ln   -s   /etc/rc.d/init.d/startdb /etc/rc.d/rc0.d/K01startdb

 

方法2

把下面這段直接加/etc/rc.local裡面,或者寫成一個腳本,加上可執行權限,把文件路徑加到/etc/rc.local最下面。

 

#Auto Start Oralce Instance and Listener

 

ORACLE_HOME=/u01/product/oracle;export ORACLE_HOME

ORACLE_SID=dell;export ORACLE_SID

 

su oracle -c "$ORACLE_HOME/bin/sqlplus /nolog <

connect / as sysdba

startup;

exit

EOF"

 

su oracle -c "$ORACLE_HOME/oracle/bin/lsnrctl <

start

exit

EOF"


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15843490/viewspace-584492/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15843490/viewspace-584492/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值