오라클 Automating Database Startup and Shutdown.
1) root계정으로 로그인
2) 시스템 시스템에 맞게 oratab 파일 수정
SOLARIS 일경우
$ vi /var/opt/oracle/oratab 파일을 수정
orcl:/export/home/oracle/oraapp/product/10.2.0:Y
기존에 N으로 된것을 Y 로 변경 처리
AIX, HP-UX, LINUX, Tru64 UNIX 일경우
$ vi /etc/oratab 파일을 수정
SID:ORACLE_HOME:{Y|N|W} 형태로 되어 있는데 자동 시작을 위해서 "Y" 로 변경 처리
3) 시스템이 시작시 구동되는 디렉토리 위치로 이동
- AIX : /etc/
- 리눅스와 SOLARIS : /etc/init.d/
- HP-UX와 Tru64 UNIX : /sbin/init.d/
4) dbora 파일을 생성하고 아래 내용 입력 처리
--------------------------------------------------------
#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
ORACLE_HOME=/export/home/oracle/oraapp/product/10.2.0
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
if [ "$PLATFORM" = "HP-UX" ] ; then
remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
exit
else
rsh $HOST -l $ORACLE $0 $1 ORA_DB
exit
fi
fi
#
case $1 in
'start')
if [ "$PLATFORM" = "Linux" ] ; then
touch /var/lock/subsys/dbora
fi
$ORACLE_HOME/bin/dbstart $ORACLE_HOME &
;;
'stop')
$ORACLE_HOME/bin/dbshut $ORACLE_HOME &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
--------------------------------------------------------
5) dbora파일의 그룹과 권한을 변경 처리
# chgrp dba dbora
# chmod 750 dbora
6) Symbolic Link생성
AIX 일경우
# ln -s /etc/dbora /etc/rc.d/rc2.d/S99dbora
# ln -s /etc/dbora /etc/rc.d/rc2.d/K01dbora
HP-UX 일경우
# ln -s /sbin/init.d/dbora /sbin/rc3.d/S990dbora
# ln -s /sbin/init.d/dbora /sbin/rc0.d/K001dbora
Linux 일 경우
# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
Solaris 일 경우
# ln -s /etc/init.d/dbora /etc/rc0.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
Tru64 UNIX 일 경우
# ln -s /sbin/init.d/dbora /sbin/rc3.d/S99dbora
# ln -s /sbin/init.d/dbora /sbin/rc0.d/K01dbora
참고 URL
http://docs.oracle.com/cd/B19306_01/server.102/b15658/strt_stp.htm#CFAHAHGA
/****************************************************/
$> vi /var/opt/oracle/oratab
---------------------------------------------------------------------
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/export/home/oracle/oraapp/product/10.2.0:Y
---------------------------------------------------------------------
$> vi /etc/init.d/dbora 파일 생성
#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
ORACLE_HOME=/export/home/oracle/oraapp/product/10.2.0
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
#
case $1 in
'start')
su - $ORACLE -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
;;
'stop')
su - $ORACLE -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
$> chgrp dba dbora
$> chmod 750 dbora
$>ln -s /etc/init.d/dbora /etc/rc0.d/K01dbora
$> ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
#>vi /export/home/oracle/oraapp/product/10.2.0/dbstart 파일수정
#>vi /export/home/oracle/oraapp/product/10.2.0/dbshut 파일수정
/***********************************************************************/