After following the first three posts on Oracle installation, you should finish installing Oracle successfully. We'll further discuss how-to-start and shutdown Oracle related services manually and automatically in the this post.
Manually
1) Start up
Login as Oracle user and start sqlplus utility.
> Startup
Start Oracle Listener
Start Emctl (Optional)
$ emctl Start Dbconsole
Start Web browser and log into the console
2) Shutdown
Login as Oracle user and start sqlplus utility.
Stop Listener
Stop Oracle Server
> Shutdown Immediate
Stop Emctl
$ emctl Stop Dbconsole
Automatically
1) Modify Oracle system configuration to enable Dbstart and Dbshut
$su - oracle $vi /etc/oratab
2) Create Oracle startup&shutdown script in/etc/init.d. The sample script is attached below.
#!/bin/SH#chkconfig: * the About# description:oracle Auto Start-Stop script.## Set ora_home to being equivalent to the $ORACLE _home# fromwhichYou wish to execute Dbstart and dbshut;## Set Ora_owner to the userIDOf the owner of the# Oracle databaseinchOra_home. Ora_home=/pdm/db/oracle/product/11.2.0/Dbhome_1ora_owner=Oracleif[!-F $ORA _home/bin/Dbstart] Then Echo "Oracle startup:cannot Start"Exitfi Case " $" inch'Start') # Start the Oracle databases:Echo "starting Oracle Databases and listener ..."Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:starting Oracle Databases as part of the system up.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oraclesu-$ORA _owner-c"$ORA _home/bin/dbstart $ORA _home">>/var/log/OracleEcho " Done"# Start The Listener:#echo "starting Oracle Listeners ..."#echo "-------------------------------------------------">>/var/log/Oracle#date+"%T%a%d:starting Oracle Listeners as part of the system up.">>/var/log/Oracle#echo "-------------------------------------------------">>/var/log/Oracle#su-$ORA _owner-c"$ORA _home/bin/lsnrctl Start">>/var/log/Oracle#echo "Done ."#echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:finished.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/OracleTouch/var/lock/subsys/Oracle;;'Stop') # Stop the Oracle Listener:#echo "stoping Oracle Listeners ..."#echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:stoping Oracle Listener and Server as part of the system down.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oracle#su-$ORA _owner-c"$ORA _home/bin/lsnrctl Stop">>/var/log/Oracle#echo "Done ."RM-f/var/lock/subsys/oracle# Stop The Oracle Database:Echo "stoping Oracle Databases and Listener ..."Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:stoping Oracle Databases as part of the system down.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oraclesu-$ORA _owner-c"$ORA _home/bin/dbshut $ORA _home">>/var/log/OracleEcho "Done ."Echo ""Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:finished.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oracle;;'Restart')$0stop$0start;;Esac
3) Change script mode to 755
chmod 755 /etc/init.d/oracle
4) ADD Oracle Service
Chkconfig–level Oracle on
5) Create Symbolic Links for Oracle shutdown on run level 0 and 6
#for Run Level 0 (shutdown)
Ln -s/etc/init.d/oracle/etc/rc0.d/k99oracle # for Run Level 6 (restart)
LN -s/etc/init.d/oracle/etc/rc6.d/k99oracle
Reference Material
The following URLs is useful about Oracle services startup and shutdown.
http://www.cnblogs.com/panjun-Donet/archive/2010/08/10/1796873.html (Linux chkconfig command detailed)
http://www.cnblogs.com/mchina/archive/2012/11/27/2782993.html (Linux Oracle service start & Stop script with boot)
Http://www.linuxidc.com/Linux/2007-06/4892.htm (enables Linux to perform a task automatically when shutting down or restarting)
Http://wenku.baidu.com/link?url=sK_FphbS_rtO_BkbpshLzJRxLu76s3bWWrgtAqlh540f4CNnRcQr5PffiRGd-eVZCjffcBPs8_ Kmm3jundnrlenqel0ltarwuswi0oiugro
Http://www.cnblogs.com/bangerlee/archive/2012/03/30/2412652.html (Linux process hosting and daemon settings)