分类: Oracle
2010-05-20 17:24:35
1. 增加启动脚本
touch /etc/init.d/orcl
vi orcl
# !/bin/bash
# whoami
# root
# chkconfig: 345 51 49
# /etc/init.d/orcl
# description: starts the oracle dabase deamons
#
ORA_HOME=/home/oracle/product/10.2.0/db_1/
ORA_OWNER=oracle
case "$1" in
start)
echo -n "Starting orcl: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
touch /var/lock/subsys/orcl
echo
;;
stop)
echo -n "shutting down orcl: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
rm -f /var/lock/subsys/orcl
echo
;;
restart)
echo -n "restarting orcl: "
$0 stop
$0 start
echo
;;
*)
echo "Usage: `basename $0` start|stop|restart"
exit 1
esac
exit 0
保存 orcl 并退出
2. 增加配置服务
/sbin/chkconfig --add orcl
3. 修改 /etc/oratab 文件
vi /etc/oratab
ORACLE_SID:ORACLE_HOME:Y -- 是否自启动
4. 重启一下
或者简单的配置 /etc/rc.d/rc.local 增加两条启动命令
su - oracle -c /home/oracle/product/10.2.0/db_1/bin/dbstart
su - oracle -c /home/oracle/product/10.2.0/db_1/bin/lsnrctl start
原文链接: