1.修改oratab,因为我们需要使用dbstart utility
- [root@ora01 ~]# vi /etc/oratab
-
orcl:/u01/app/oracle/product/10.2.0/db_1:Y
2.修改启动文件/u01/app/oracle/product/10.2.0/db_1/bin/dbstart
- 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
- #!/bin/bash
-
#/etc/init.d/oracle chmod +x oracle
-
# oracle This shell script takes care of starting and stopping
-
# the MySQL subsystem (mysqld).
-
# chkconfig: - 90 10
-
# description: Oracle database server.
-
# processname: oracle
-
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
-
ORA_OWNER=oracle
-
-
prog="Oracle"
-
-
# Source function library.
-
. /etc/rc.d/init.d/functions
-
-
if [ ! -f $ORA_HOME/bin/dbstart ]
-
then
-
echo "Oracle startup: cannot start"
-
exit
-
fi
-
-
start(){
-
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart >/dev/null 2>&1 &
-
ret=$?
-
if [ $ret -eq 0 ]; then
-
action $"Starting $prog: " /bin/true
-
else
-
action $"Starting $prog: " /bin/false
-
fi
-
[ $ret -eq 0 ] && touch /var/lock/subsys/oracled
-
return $ret
-
}
-
-
stop(){
-
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut >/dev/null 2>&1
-
ret=$?
-
if [ $ret -eq 0 ]; then
-
action $"Stopping $prog: " /bin/true
-
else
-
action $"Stopping $prog: " /bin/false
-
fi
-
[ $ret -eq 0 ] && rm -f /var/lock/subsys/oracled
-
return $ret
-
}
-
restart(){
-
stop
-
start
-
-
}
-
# See how we were called.
-
case "$1" in
-
start)
-
start
-
;;
-
stop)
-
stop
-
;;
-
restart)
-
restart
-
;;
-
condrestart)
-
condrestart
-
;;
-
*)
-
echo $"Usage: $0 {start|stop|restart}"
-
exit 1
-
esac
4.以root用户启动关闭oracle
- [root@ora01 ~]# /etc/init.d/oracle start
-
[root@ora01 ~]# /etc/init.d/oracle stop
在使用drbd,heartbeat做HA时可以将listener和数据库启动分开。
阅读(1227) | 评论(0) | 转发(0) |