Skip to content

Commit 02db96e

Browse files
committed
added oracle init.d script
1 parent f98fed9 commit 02db96e

File tree

1 file changed

+93
-0
lines changed
  • Oracle Scripts/Oracle DB/init.d

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/bash
2+
# chkconfig: 345 90 10
3+
# description: Control oracle database process
4+
#
5+
# File: /etc/init.d/oracle
6+
# Purpose: Start and stop the Oracle database services
7+
# Author: bthompso (Conundrum)
8+
# Date: 3/11/2014
9+
#
10+
# Absolutely no warranty, use at your own risk
11+
# Please include this header in any copy or reuse of the script you make
12+
#
13+
# Version 0.01
14+
#
15+
# Usage:
16+
# 1: Create file at /etc/init.d/oracle
17+
# 2: chmod 750 /etc/init.d/oracle
18+
# 3: chkconfig --add oracle
19+
#
20+
#------------------------------------
21+
#
22+
# The following values must be changed for your environment
23+
#
24+
25+
ORACLE_HOME=ORACLE_HOME
26+
ORACLE_USER=oracle
27+
28+
29+
30+
# The following values should not need to be modified
31+
32+
SUBSYS=$(basename $0)
33+
LOCKFILE='/var/lock/subsys/'$SUBSYS
34+
35+
#-----------------------------------------------
36+
37+
38+
# source init.d functions
39+
#----------------------------
40+
. /etc/rc.d/init.d/functions
41+
42+
# source environment variables
43+
. /home/oracle/OBITEST.env
44+
#----------------------------
45+
46+
47+
case "$1" in
48+
'start')
49+
if [ -f $LOCKFILE ]; then
50+
echo $0 already running.
51+
exit 1
52+
fi
53+
echo -n $"Starting Oracle Database:"
54+
# su $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
55+
su $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
56+
# su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
57+
touch $LOCKFILE
58+
;;
59+
'stop')
60+
if [ ! -f $LOCKFILE ]; then
61+
echo $0 already stopping.
62+
exit 1
63+
fi
64+
echo -n $"Stopping Oracle Database:"
65+
# su $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
66+
su $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
67+
# su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
68+
rm -f $LOCKFILE
69+
;;
70+
'restart')
71+
$0 stop
72+
$0 start
73+
;;
74+
'status')
75+
echo -n ' Oracle Status is '
76+
if [ -f $LOCKFILE ]; then
77+
echo_success
78+
else
79+
echo_not_running
80+
fi
81+
;;
82+
*)
83+
echo "Usage: $0 [start|stop|status]"
84+
exit 1
85+
esac
86+
87+
exit 0
88+
89+
90+
91+
92+
93+

0 commit comments

Comments
 (0)