测试机总是断电,导致重启后oracle不自动重启,需要手工操作,因此可以设置成自启动模式。操作系统:linux
测试机总是断电,导致重启后oracle不自动重启,需要手工操作,因此可以设置成自启动模式。
操作系统:linux
数据库:oracle 10g
1、vi /etc/oratab
找到bisal:/opt/oracle/102:n,将n设为y。
文件的注释:
# 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.
可以看到这里$oracle_sid是bisal,$oracle_home是/opt/oracle/102。
设置为y时,,允许实例自启动,当设置为n时,则不允许自启动。
这个文件里的配置仅仅起一个开关的作用,其并不会具体的执行启动和关闭,具体的操作由$oracle_home/bin/dbstart和dbshut 脚本来实现。 这2个脚本在执行时会检查/etc/oratab 文件里的配置,为y时才能继续执行。
2、将lsnrctl start和dbstart添加到rc.local文件中:
vi /etc/rc.d/rc.local
su oracle -lc /opt/oracle/102/bin/lsnrctl start
su oracle -lc /opt/oracle/102/bin/dbstart
文件:
#!/bin/sh
#
# this script will be executed *after* all the other init scripts.
# you can put your own initialization stuff in here if you don't
# want to do the full sys v style init stuff.
此处也可以使用自己定义的脚本作为启动脚本。
然后重启服务器,就可以看到监听和实例都可以自动启动了。