在/etc/init.d/ 下建立oracle10g檔案,在檔案內編輯以下內容
#!/bin/shcase "$1" instart) # start tsnlisnter echo "start tsnlisnter" su - oracle -c "lsnrctl start" # start database echo "Start Oracle database instance" su - oracle -c "echo \" CONN / AS SYSDBA STARTUP exit \"|sqlplus /NOLOG" # start enterprise manager echo " Start Emterprise Manager" su - oracle -c "emctl start dbconsole" # start isqlplus echo "Start isqlplus" su - oracle -c "isqlplusctl start" ;;stop) # shutdown database echo "Shutdown Oracle database instance" su - oracle -c "echo \" CONN / AS SYSDBA SHUTDOWN immediate exit \"|sqlplus /NOLOG" # stop tsnlisnter echo "Stop tsnlisnter" su - oracle -c "lsnrctl stop" # stop enterprise manager echo " Stop Emterprise Manager" su - oracle -c "emctl stop dbconsole" # stop isqlplus echo "Stop isqlplus" su - oracle -c "isqlplusctl stop" ;;*) echo "Usage: $0 { start | stop }" exit 1 ;;esacexit 0
在/etc/rc.d/ 的rc.local檔案內容中加入以下內容:
/etc/init.d/oracle10g start