[db] oracle 자동실행되게 하기.
1. /etc/oratab 의 ‘N’를 ‘Y’로 변경
ORA9:/opt/oracle/product/9.2.0.4:Y
2. /etc/init.d/dbora 파일생성 -> chmod 755 할것
————–
#!/bin/sh
#
# chkconfig: – 70 72
# description: Oracle Database 9.2.0.4
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/opt/oracle/product/9.2.0.4
ORA_OWNER=oracle
case “$1” in
start)
# Start the Oracle databases;
# The following command assumes that the oracle login
# will not prompt the user for any values
su – $ORA_OWNER -c $ORA_HOME/bin/dbstart
;;
stop)
# Stop the Oracle databases;
# The following command assumes that the oracle login
# will not prompt the user for any values
su – $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo “Usage: $0 {start|stop|restart}”
exit 1
esac
exit 0
———————-
3. /etc/init.d/dblsnr 파일 생성 -> chmod 755 할것
———————-
#!/bin/sh
#
# chkconfig: – 71 71
# description: Oracle databases listener
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/opt/oracle/product/9.2.0.4
ORA_OWNER=oracle
case “$1” in
start)
# Start the Oracle databases listener;
# The following command assumes that the oracle login
# will not prompt the user for any values
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start”
;;
stop)
# Stop the Oracle databases listener;
# The following command assumes that the oracle login
# will not prompt the user for any values
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop”
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo “Usage: $0 {start|stop|restart}”
exit 1
esac
exit 0
——————
4. /etc/init.d/dbagent 파일생성 -> chmod 755 할것
————–
#!/bin/sh
#
# chkconfig: – 72 70
# description: Oracle Intelligent Agent
#
# 어떤환경변수가 쓰이는지 몰라서.. 다 불러온다.
source ~oracle/.bash_profile
case “$1” in
start)
$ORACLE_HOME/bin/agentctl start
;;
stop)
$ORACLE_HOME/bin/agentctl stop
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo “Usage: $0 {start|stop|restart}”
exit 1
esac
exit 0
———————-
5. chkconfig 사용 rc.d에 등록한다.
chkconfig –add dbora
chkconfig –level 2345 dbora on
chkconfig –add dblsnr
chkconfig –level 2345 dblsnr on
chkconfig –add dbagent
chkconfig –level 2345 dbagent on
6. 혹시 실행하지 못한다는 메시지가 뜨면…
$ORACLE_HOME/dbs 디렉토리에서…
ln -s spfile<sid>.ora init<sid>.ora