编辑/etc/oratab文件,将orcl:/opt/oracle/product/10.2.0/db_1:N改为orcl:/opt/oracle/product/10.2.0/db_1:Y
在/etc/rc.d/init.d目录下配置oracle服务文件,执行下列命令:
touch oracle //创建文件
chmod a+x oracle //设置可执行权限
添加以下内容:
#!/bin/bash
#description:starts the oracle database deamons
ORA_HOME="/opt/oracle/product/10.2.0/db_1"
ORA_OWNER="oracle"
case $1 in
'start')
echo -n "***Starting Oracle***"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
;;
'stop')
echo -n "***Stopping Oracle***"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
;;
'restart')
echo -n "***Restarting Oracle***"
$0 stop
$0 start
;;
'isqlstart')
echo "***Starting Oracle iSQL PLus***"
su - $ORA_OWNER -c "$ORA_HOME/bin/isqlplusctl start"
echo "*** Note:You can access service at url:http://$(hostname):5560/isqlplus"
;;
'isqlstop')
echo "***Stopping Oracle iSQL Plus***"
su - $ORA_OWNER -c "$ORA_HOME/bin/isqlplusctl stop"
;;
'emstart')
echo "***Starting Oracle Enterprise Manager 10g Database control***"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
echo "Note:You can access service as url:http://$(hostname):1158/em"
;;
'emstop')
echo "***Stopping Oracle Enterprise Manager 10g Database control***"
su - $ORA_OWNER -c "ORA_HOME/bin/emctl stop dbconsole"
;;
'*')
echo "Usage:$0 {start|stop|isqlstart|isqlstop|emstart|emstop}"
exit 1
esac
exit 0
执行下列命令测试:
/etc/rc.d/init.d/oracle start
/etc/rc.d/init.d/oracle stop
测试成功后,执行下列命令添加到系统服务中:
chkconfig –add oracle
chkconfig –list oracle
重新启动服务器。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14876437/viewspace-584331/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14876437/viewspace-584331/