oracle 10G在rhel5下开机启动启动设置
2010-08-05 11:20
357 查看
首先在/etc/init.d/目录下配置Oracle的服务文件.
1. touch oracle10g
2. chmod a+x oracle10g
[root@oracle10g ~]# vim /etc/init.d/oracle10g
# !/bin/bash
# whoami
# root
# chkconfig: 345 51 49
# /etc/init.d/oracle10g
# description: starts the oracle dabase deamons
#
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle
case "$1" in
start)
echo -n "Starting oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
touch /var/lock/subsys/oracle10g
echo
;;
stop)
echo -n "shutting down oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole"
rm -f /var/lock/subsys/oracle10g
echo
;;
restart)
echo -n "restarting oracle10g: "
$0 stop
$0 start
echo
;;
*)
echo "Usage: `basename $0` start|stop|restart"
exit 1
esac
exit 0
[root@oracle10g ~]#cp oracle10g /etc/init.d/
保存文件,退出以后,
3.添加并启动察看服务.
1./sbin/chkconfig --add oracle10g
2./sbin/chkconfig --list oracle10g
3./sbin/chkconfig --level 345 oracle10g on
重新启动Linux的时候,如果看到启动项Oracle出现OK,代表Oracle成功随Linux启动了.
注意:
这样的脚本启动一般不会启动实例,如果想让实例也随脚本一起启动的话,就需要修改文件:/etc/oratab
如果这个文件不存在,那么就得运行脚本文件产生它root.sh(以root身份运行)
#
# 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:<N|Y>:
#
# 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.
#
#
orcl:/oracle/product/10.2.0/db_1:N
gzgi:/oracle/app/oracle/product/10.2.0/db_1:Y看设置,可以看出实例 gzgi 是自动启动的(表识是Y),而orcl的表识是N,则不启动.只要在这里设置好后,在配合上面的脚本,即可实现开机自动启动oracle以及实例了.
1. touch oracle10g
2. chmod a+x oracle10g
[root@oracle10g ~]# vim /etc/init.d/oracle10g
# !/bin/bash
# whoami
# root
# chkconfig: 345 51 49
# /etc/init.d/oracle10g
# description: starts the oracle dabase deamons
#
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle
case "$1" in
start)
echo -n "Starting oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
touch /var/lock/subsys/oracle10g
echo
;;
stop)
echo -n "shutting down oracle10g: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" &
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole"
rm -f /var/lock/subsys/oracle10g
echo
;;
restart)
echo -n "restarting oracle10g: "
$0 stop
$0 start
echo
;;
*)
echo "Usage: `basename $0` start|stop|restart"
exit 1
esac
exit 0
[root@oracle10g ~]#cp oracle10g /etc/init.d/
保存文件,退出以后,
3.添加并启动察看服务.
1./sbin/chkconfig --add oracle10g
2./sbin/chkconfig --list oracle10g
3./sbin/chkconfig --level 345 oracle10g on
重新启动Linux的时候,如果看到启动项Oracle出现OK,代表Oracle成功随Linux启动了.
注意:
这样的脚本启动一般不会启动实例,如果想让实例也随脚本一起启动的话,就需要修改文件:/etc/oratab
如果这个文件不存在,那么就得运行脚本文件产生它root.sh(以root身份运行)
#
# 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:<N|Y>:
#
# 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.
#
#
orcl:/oracle/product/10.2.0/db_1:N
gzgi:/oracle/app/oracle/product/10.2.0/db_1:Y看设置,可以看出实例 gzgi 是自动启动的(表识是Y),而orcl的表识是N,则不启动.只要在这里设置好后,在配合上面的脚本,即可实现开机自动启动oracle以及实例了.
相关文章推荐
- 在RHEL5.4下设置开机自动启动ORACLE 11G
- RHEL5下Oracle 10g 数据库(单数据库)的自动启动与关闭
- RHEL 5.4 Oracle 10g Startup Script(开机启动)
- 安装最后一步:linux设置oracle数据库和监听开机自动启动
- Linux开机自动启动ORACLE设置
- linux下oracle设置开机自启动实现方法
- Linux开机自动启动ORACLE设置
- Linux下设置oracle 10g 服务以及实例自动启动方法
- oracle的环境配置-设置开机(Linux)自动启动Oracle关机自动关闭Oracle
- Linux开机自动启动ORACLE设置
- Linux开机自动启动ORACLE设置
- RHEL5下安装Oracle_10G_RAC 异常一例
- linux系统下设置oracle开机自动启动
- linux设置oracle数据库和监听开机自动启动
- [Oracle] Linux下开机自动启动Oracle的设置
- rhel5下ORACLE 10g之ASM创建
- Linux开机自动启动ORACLE设置
- linux下oracle设置开机自启动实现方法
- linux系统下设置oracle开机自动启动
- windows设置oracle实例开机自动启动