Oracle start/stop script that works | skybert.net

Oracle start/stop script that works


The oracle start/stop script I’ve found on the net (written for REHL, I believe), didn’t work for me. Thus, I wrote a wee script that works for my 11g install (on Debian).

 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
32
33
#! /usr/bin/env bash

function stop_db()
{
  sqlplus /nolog <<EOF
  connect /as sysdba
  shutdown
  EOF
  lsnrctl stop
}

function start_db()
{
  sqlplus /nolog <<EOF
  connect /as sysdba
  startup
  EOF
  lsnrctl start
}

case "$1" in
  start)
    start_db
    ;;
  stop)
    stop_db
    ;;
  *)
    echo "Usage:" `basename $0` ""
    ;;
esac

exit 0

As you can see, its far simpler than the more “official” scripts, but it does exactly what I want it to, so I’m happy :-)


gmail torstein.k.johansen @ gmail ~ twitter @torsteinkrause ~