solaris 10下的oracle 10g 自動啟動指令碼

rainbowbridg發表於2007-08-17

solaris 10下的oracle 10g 自動啟動指令碼

Posted in:

#!/bin/sh

case “$1″ in
start)

# start tsnlisnter
echo “start tsnlisnter”
su - oracle -c “lsnrctl start”

# start database
echo “Start Oracle database instance”
su - oracle -c “echo ”
CONN SYS/PASSWORD 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 SYS/PASSWORD 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
;;
esac
exit 0
save as /etc/init.d/oracle10g and then

#ln [-s] /etc/init.d/oracle10g /etc/rc2.d/S99oracle10g
#ln [-s] /etc/init.d/oracle10g /etc/rc0.d/K00oracle10g

Please change “PASSWORD” to your SYS account password!!

I test on Solaris 10

[@more@]1、在/etc/init.d/目錄下新建oraclestart指令碼
oraclestart eg.
#------------------------------------------------------
# 啟動Oracle監聽和例項指令碼
#------------------------------------------------------
su - oracle <echo 'Start Oracle Services ...'
lsnrctl start
sqlplus /nolog <conn /as sysdba;
startup
exit

2、將oraclestart改成可執行
chmod 744 oraclestart

3、然後作一個連線
ln -s /etc/init.d/oraclestart /etc/rc2.d/S99oraclestart
ln -s /etc/init.d/oraclestart /etc/rc0.d/K10oraclestart

4、最後reboot,啟動後檢視監聽和Oracle例項是否啟動

上述指令碼在Solaris 10上除錯透過

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

相關文章