windows环境和unix环境都能够实现oracle数据库的自动启动。
windows环境和unix环境都能够实现oracle数据库的自动启动。
windows环境下:
实验方法相对简单,通过修改注册表或用oradim命令来实现:
oradim -edit -startmode [auto|manual] -shutmode [nomal|immediate|abort]
unix环境下:
通过数据库自带的dbstart命令来实验.
命令: dbstart + {oracle_home的全路径}
原理:
1. 操作系统启动过程中,读取/etc/oratab文件,判断是否有哪些数据库是需要自动启动的(n代表不自动启动,y代表自动启动)
ora10g:/u01/app/oracle/product/10.2.0:y catdb:/u01/app/oracle/product/10.2.0:n
2. 调用dbstart命令启动监听器和数据库
查看脚本全路径为$oracle_home/bin/dbstart,会注意到:
监听器的启动受环境变量oracle_home_listner影响
以linux环境操作过程为例:
1. 如下编辑/etc/oratab文件
[oracle@ora10g bdump]$ cat /etc/oratab
# 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.
#
#
ora10g:/u01/app/oracle/product/10.2.0:y catdb:/u01/app/oracle/product/10.2.0:n
注: 数据库实例为ora10g,它的安装目录位置/u01/app/oracle/product/10.2.0,开户自动启动
2. 添加dbstart命令至rc.local.如下:
[oracle@ora10g bdump]$ cat /etc/rc.local
#!/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.
touch /var/lock/subsys/local
su - oracle -c dbstart /u01/app/oracle/product/10.2.0
至此,自动启动的环境准备完成了.可以通过dbstart +{数据库安装目录全路径}来做测试或重启验证了...
本文永久更新链接地址:
,