Linux Oracle 隨系統自動啟動

chicken0915發表於2012-07-28
 

oracle自動啟動選項,編輯/etc/rc.d/rc.local  #註釋去掉

=================================================================================================

#su - oracle -c 'dbstart'

#su - oracle -c 'lsnrctl start

 

系統開機自動掛載磁碟,編輯/etc/fstab 新增一下內容

=================================================================================================

/dev/sdb1                /u01/md          ext3    defaults      1 1

 

新增oracle服務到系統,穿件/etc/init.d/oracle 檔案,內容如下。

可以使用 service oracle start|stop|restart 命令 開啟|關閉|重啟 資料庫

=================================================================================================

#! bin/bash

case "$1" in

start)

        echo "Starting Oracle Listener and Database...."

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        date >>/u01/md/lzk/oracle

        echo "Starting Oracle Listener and Database....">>/u01/md/lzk/oracle

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        echo "Starting Oracle Listener and Database...."

        su - oracle -c dbstart >>/u01/md/lzk/oracle

        echo "Done."

        echo " "

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        date >>/u01/md/lzk/oracle

        echo "Finished." >>/u01/md/lzk/oracle

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        touch /var/lock/subsys/oracle

        ;;

stop)

        echo "Stop Oracle Database and Listener...."

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        date >>/u01/md/lzk/oracle

        echo "Stop Oracle Listener and Database....">>/u01/md/lzk/oracle

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        su - oracle -c dbshut >>/u01/md/lzk/oracle

        rm -f /var/lock/subsys/oracle

        echo "Done."

        echo " "

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        date >>/u01/md/lzk/oracle

        echo "Finished." >>/u01/md/lzk/oracle

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        ;;

restart)

        echo "Restarting Oracle Database and Listener...."

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        date >>/u01/md/lzk/oracle

        echo "Restarting Oracle Database and Listener" >>/u01/md/lzk/oracle

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        echo "Done."

        echo " "

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        date >>/u01/md/lzk/oracle

        echo "Finished." >>/u01/md/lzk/oracle

        echo "-----------------------------------------">>/u01/md/lzk/oracle

        touch /var/lock/subsys/oracle

;;

*)

        echo "Usage: oracle { start|stop|restart }"

        exit 1

esac

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7755871/viewspace-737901/,如需轉載,請註明出處,否則將追究法律責任。

相關文章