Linux自动启动Oracle数据库
2009-01-04 10:24
211 查看
这里介绍一下关于UNIX/Linux下的Oracle自启动的方法,在介绍之前先说明一下,在WIN平台下数据库的启动是由操作系统控制的,当系统启动或关闭的时候,首先把数据库的服务自动启动或着关闭掉,也不会影响到数据库的数据读写方面的问题或其他数据操作故障,但在UNIX/Linux下只是开启或关闭在系统默认的服务进程程序,不会对数据库服务进行任何操作,因此自动化关闭是推荐的,它保护数据库不适当的关闭引起联贯的问题!
正文:(以LINUX AS3为例!)
dbshut和dbstart脚本位于$ORACLE_HOME/bin目录并且可以用于自动化数据库启动和关闭。
dbstart和dbshut脚本引用在oratab文件中同样的条目,因此脚本必须适用于同一个数据库集合。例如,你不能让dbstart已自动启动数据库sid1、sid2和sid3,而让dbshut仅关闭数据库sid1和sid2。然而,你可以指定dbshut关闭当前dbstart根本没使用的数据库。要做到这样,在
关闭文件中包括dbshut但是在系统启动文件中省略dbstart。
也可见: 对于系统启动和关闭过程的描述,检查你的操作系统关于init命令的文档。
自动化数据库启动和关闭
本过程必须对你想要配置成自动化启动和关闭的每个新数据库完成。执行下列任务建立dbstart和dbshut脚本以便他们在系统启动被调用:
1. 编辑/etc/oratab文件。
在oratab文件中的数据库入口以下列格式出现:
ORACLE_SID:ORACLE_HOME:{Y|N}
这里Y或N指定你是否想要dbstart和dbshut脚本启动并关闭数据库。找出你想要启动的所有数据库入口。他们有第一列的sid指出。改变最后一个列为Y。
2. 在/etc/rc.d/init.d目录下创建一个名为dbora(如果它还不存在)的文件。
3. 在dbora文件末尾创建类似于下面的入口(如果他们还不存在)。确定给出完整的dbstart实用程序的路径。
#!/bin/sh
# Set ORA_HOME to be equivalent to the ORACLE_HOME
# from which you wish to execute dbstart and
# dbshut
# set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME
ORA_HOME=/u01/app/oracle/product/9.1.0
ORA_OWNER=oracle
if [! -f $ORA_HOME/bin/dbstart]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart &
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut &
esac
4. 链接dbora,输入:
5. # ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc0.d/K10dbora
6. # ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc2.d/S99dbora
作为Oracle用户执行的配置任务
作为oracle用户执行下列任务。
正文:(以LINUX AS3为例!)
dbshut和dbstart脚本位于$ORACLE_HOME/bin目录并且可以用于自动化数据库启动和关闭。
dbstart和dbshut脚本引用在oratab文件中同样的条目,因此脚本必须适用于同一个数据库集合。例如,你不能让dbstart已自动启动数据库sid1、sid2和sid3,而让dbshut仅关闭数据库sid1和sid2。然而,你可以指定dbshut关闭当前dbstart根本没使用的数据库。要做到这样,在
关闭文件中包括dbshut但是在系统启动文件中省略dbstart。
也可见: 对于系统启动和关闭过程的描述,检查你的操作系统关于init命令的文档。
自动化数据库启动和关闭
本过程必须对你想要配置成自动化启动和关闭的每个新数据库完成。执行下列任务建立dbstart和dbshut脚本以便他们在系统启动被调用:
1. 编辑/etc/oratab文件。
在oratab文件中的数据库入口以下列格式出现:
ORACLE_SID:ORACLE_HOME:{Y|N}
这里Y或N指定你是否想要dbstart和dbshut脚本启动并关闭数据库。找出你想要启动的所有数据库入口。他们有第一列的sid指出。改变最后一个列为Y。
2. 在/etc/rc.d/init.d目录下创建一个名为dbora(如果它还不存在)的文件。
3. 在dbora文件末尾创建类似于下面的入口(如果他们还不存在)。确定给出完整的dbstart实用程序的路径。
#!/bin/sh
# Set ORA_HOME to be equivalent to the ORACLE_HOME
# from which you wish to execute dbstart and
# dbshut
# set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME
ORA_HOME=/u01/app/oracle/product/9.1.0
ORA_OWNER=oracle
if [! -f $ORA_HOME/bin/dbstart]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart &
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut &
esac
4. 链接dbora,输入:
5. # ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc0.d/K10dbora
6. # ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc2.d/S99dbora
作为Oracle用户执行的配置任务
作为oracle用户执行下列任务。
相关文章推荐
- linux开机自动启动ORACLE数据库
- 在linux系统下,Oracle数据库开机后自动启动
- 在Linux上自动启动和关闭Oracle数据库(9i/10g/11g)
- Linux(CentOS)下设置nginx开机自动启动(2个办法)
- Linux下Oracle 11g数据库自动启动和关闭
- Linux新加硬盘分区并设置系统启动自动挂载的方法
- 嵌入式 Linux 与linux启动时自动加载模块
- 嵌入式 Linux 与linux启动时自动加载模块
- Linux下让Oracle服务自动启动与停止
- linux开机自动启动脚本
- linux设置开机服务自动启动/关闭自动启动命令 chkconfig
- Linux 中 如何在启动时,自动挂载其他硬盘
- linux 服务器自动启动
- linux下oracle数据库服务和监听的启动停止
- linux设置开机服务自动启动
- Linux 开机自动启动服务
- linux开机自动启动脚本
- Tomcat 在 Linux 下的自动启动脚本
- linux 开机自动启动 shell
- 在linux中怎么让进程开机自动启动?