oracle linux自启动

liunx下可以修改/etc/rc.d/rc.local,加上:

su - oracle -c 'lsnrct start'
su - oracle -c 'dbstart'
(或者用init脚本)

同时修改/etc/oratab中结尾把N改成Y


===========================================================
vi /etc/oratab
SID:ORACLE_HOME:Y

自动启动脚本/etc/rc.d/init.d/oracle
case "$1" in
start)
echo "Starting Oracle Database..."
echo "-------------------------------" >> /var/log/oracle
date +"%T %a %D :Starting Oracle Database as part of system up." >> /var/log/oracle
echo "-------------------------------" >> /var/log/oracle
su - oracle -c "dbstart" >> /var/log/oracle
echo "Done."
echo "Starting Oracle Listeners ... "
echo "--------------------------------" >> /var/log/oracle
date +"%T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracle
echo "--------------------------------" >> /var/log/oracle
su - oracle -c "lsnrctl start" >> /var/log/oracle
echo "Done."
echo " "
echo "----------------------------------" >> /var/log/oracle
date +" %T %a %D : Finished. " >> /var/log/oracle
touch /var/lock/subsys/oracle

;;
stop)
echo "Stoping Oracle Listener ... "
echo "----------------------------------" >> /var/log/oracle
date +"%T %a %D : Stoping Oracle Listener as part of system down. " >> /var/log/oracle
echo "----------------------------------" >> /var/log/oracle
su - oracle -c "lsnrctl stop" >> /var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
echo "Stoping Oracle Databases ... "
echo "------------------------------------" >> /var/log/oracle
date +"%T %a %D : Stoping Oracle Databases as part of system down." >> var/log/oracle
echo "------------------------------------" >> /var/log/oracle
su - oracle -c "dbshut" >> /var/log/oracle
echo "Done."
echo " "
echo "------------------------------------" >> /var/log/oracle
date +"%T %a %D : Finsthed." >> /var/log/oracle
echo "------------------------------------" >> /var/log/oracle

;;
restart)
$0 stop
$0 start

;;
*)
echo "Usage: oracle { start | stop | restart } "
exit 1
esac

chmod 755 /etc/rc.d/init.d/oracle

ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc2.d/S99oracle
ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc3.d/S99oracle
ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc5.d/S99oracle

ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc0.d/K01oracle
ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc6.d/K01oracle

你可能感兴趣的:(oracle,C++,c,linux,C#)