Oracle 11.1.0 Auto-Startup on Linux

1. 編輯 “/etc/oratab” 將 restart flag 設成 ‘Y’

testdb:/u01/app/oracle/product/11.1.0/db_1:Y

2. 建立 “/etc/init.d/dbora” 內容如下:

#!/bin/sh

ORA_HOME=/u01/app/oracle/product/11.1.0/db_1
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo “Oracle startup: cannot start”
exit
fi

case “$1” in
‘start’)
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start”
su – $ORA_OWNER -c $ORA_HOME/bin/dbstart
touch /var/lock/subsys/dbora
;;

‘stop’)
su – $ORA_OWNER -c $ORA_HOME/bin/dbshut
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop”
rm -f /var/lock/subsys/dbora
;;
esac

3. 修改權限如下:

chmod 750 /etc/init.d/dbora

4. 取得run level, 建立 symbolic link

runlevel

X改成runlevel的值

ln -s /etc/init.d/dbora /etc/rcX.d/S99dbora

之後開機就會自動啟動 Oracle 了.


Reference:

http://www.oracle-base.com/articles/linux/AutomatingDatabaseStartupAndShutdownOnLinux.php

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s