When We configure an Oracle instance, how to start it automatically when the os restart
(1)vi /etc/oratab
orcl:/usr/local/oracle/product/9.2.0:Y
(2)vi /home/oracle/.bash_profile
ORACLE_SID=orcl
ORAENV_ASK=NO
export ORACLE_SID ORAENV_ASK
. oraenv
(3)在 /etc/rc.d/init.d 下创建一个dbora文件。
内容如下:
#!/bin/sh
ORA_HOME=/usr/local/oracle/product/9.2.0
ORA_OWNER=oracle
if [ ! -f /bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "" in
'start') #start oracle database and listeners
su - -c "/bin/dbstart"
su - -c "/bin/lsnrctl start"
;;
'stop') #stop oracle databse and listeners
su - -c "/bin/lsnrctl stop"
su - -c "/bin/dbshut"
;;
esac
把这个文件与下列文件联接:
ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc3.d/S99dbora
ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc5.d/S99dbora
ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc0.d/K10dbora
(4)编辑dbstart文件
以oracle用户登陆
vi /usr/local/oracle/product/9.2.0/bin/dbstart
- add the following line:
SPFILE=/dbs/spfile.ora
after this line: PFILE=/dbs/init.ora
- change:
if [ -f ] ; then
to:
if [ -f -o -f ] ; then
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26706/viewspace-64566/,如需转载,请注明出处,否则将追究法律责任。