오라클 부팅시 동작하기

|

1. oratab 파일을 생성 (이미 존재한다면 수정)
#/etc/oratab 디렉토리에 아래 내용으로 oratab생성

#SID:$ORACLE_HOME:Y(yes)

DB02:/oracle/9i:Y

 

2. 오라클 자동 실행 및 종료 스크립트 생성.
/etc/init.d 디렉토리에 아래와 같은 내용으로 파일을 생성 (이름 상관없슴. 여기선 oracle이란 파일명으로 생성)


#!/bin/bash
# ORACLE_HOME = the oracle home directory
# ORACLE_HOME = the owner of the oracle DB

#
ORACLE_HOME=/oracle/9i
ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi

# 오라클 시작 부분
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values

# Listner 시작
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"

# 오라클 시작
su - $ORACLE_OWNER -c $ORACLE_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 - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
;;
esac


3. 생성한 oracle 파일의 권한을 변경.

chmod 755 /etc/init.d/oracle


4. 생성한 오라클 자동 실행 스크립트를 아래와 같이 symbolic link한다.
ln -s /etc/init.d/oracle /etc/rc0.d/K10oracle
ln -s /etc/init.d/oracle /etc/rc6.d/K10oracle


5. 서비스 실행 레벨에 따라 oracle이 실행되도록 한다.
chkconfig --level 345 oracle on

And