'오라클 auto start'에 해당되는 글 1건

  1. 2009.09.21 Oracle 자동스타트 설정

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.2.0.0
Linux x86-64

Goal

This article describes how to configure a linux box for Oracle DB auto start / shutdown

Solution

The DB server software provides the two scripts to configure automatic DB startup/shutdown with the server machine. They are
$ORACLE_HOME/bin/dbstart
$ORACLE_HOME/bin/dbshut

We need to call these scripts from the unix start/shutdown scripts (rc0.d / rc1.d etc.)

Step - 1: Check the oratab file in /etc/oratab or /var/opt/oracle/oratab
This should have the entry for the DB we are dealing with, with a value Y, like:
$ORACLE_SID:$ORACLE_HOME:Y

Step - 2: Login to root.
Save the following file in /etc/init.d/ (say the file name is dbora). Please note that /etc/init.d is RedHat specific.

-rwxr-xr-x 1 root root 1412 Aug 27 19:14 dbora

Mention the correct ORA_OWNER and ORA_HOME in the dbora

------------------ Start dbora ---------------------------------

#! /bin/bash
#
# oracle Start/Stop the Databases...
#
# chkconfig: 2345 99 10
#
# processname: oracle
# config: /etc/oratab
# pidfile: /var/run/oracle.pid

# Source function library.
. /etc/init.d/functions

RETVAL=0
ORA_OWNER="oracle"
ORA_HOME="/oracle/product/10.0.1"

# See how we were called.

prog="oracle"

start() {
echo -n $"Starting $prog: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dbora

return $RETVAL
}

stop() {
echo -n $"Stopping $prog: "
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
}

restart() {
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac

exit $?


------------------ End dbora ---------------------------------


Step - 3: From root run the following:

# cd /sbin
# chkconfig --add dbora

This will create a system service viz. dbora
# chkconfig --list

This also creates the following files:

/etc/rc2.d/S99dbora ( calls $ORACLE_HOME/bin/dbstart )
/etc/rc3.d/S99dbora ( calls $ORACLE_HOME/bin/dbstart )
/etc/rc4.d/S99dbora ( calls $ORACLE_HOME/bin/dbstart )
/etc/rc5.d/S99dbora ( calls $ORACLE_HOME/bin/dbstart )

/etc/rc0.d/K10dbora ( calls $ORACLE_HOME/bin/dbshut )
/etc/rc1.d/K10dbora ( calls $ORACLE_HOME/bin/dbshut )
/etc/rc6.d/K10dbora ( calls $ORACLE_HOME/bin/dbshut )


chkconfig refers the " # chkconfig: 2345 99 10 " from dbora.
This signifies that the service has start run level set to 2, 3, 4 and 5.Stop run level set to 0, 1 and 6. And the start priority should be 99 and stop priority be 10.

If the version is Red Hat 3 ES or more than the dbora file needs two lines of comments.
Each  service which should be manageable by chkconfig needs two or more commented lines
added to its init.d script. The second line contains  a  description  for  the service, 
and may be extended across multiple lines with backslash continuation.

For example,
# chkconfig: 2345 99 10
# description: Saves and restores system entropy pool for higher quality random number generation


Step - 4: Reboot the Linux box and check

Posted by pat98
이전버튼 1 이전버튼

05-09 04:31
Flag Counter
Yesterday
Today
Total

글 보관함

최근에 올라온 글

달력

 « |  » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

최근에 달린 댓글