startoracle.sh

 

#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# description: Startup/Shutdown Oracle listener and instance

# if the executables do not exist -- display error

if [ ! -f $ORACLE_HOME/bin/lsnrctl -o ! -d $ORACLE_HOME ]
then
        echo "Oracle startup: cannot start"
        exit 1
fi

# depending on parameter -- start, stop, restart
# of the instance and listener or usage display

case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        $ORACLE_HOME/bin/lsnrctl start
        sqlplus /nolog<<EOF
        connect / as sysdba
        startup
        quit
EOF
        echo "OK"
        ;;
    stop)
        # Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        $ORACLE_HOME/bin/lsnrctl stop
        sqlplus /nolog<<EOF
        connect / as sysdba
        shutdown immediate
        quit
EOF
        echo "OK"

你可能感兴趣的:(startoracle.sh)