Hi all,
I have a shell script which does db shutdown ..the script snippet which does this is as follows:
function call_sql_plus {
${SQLPLUS:-sqlplus} -s /nolog <<EOF
EXIT;
EOF
if [ $? -ne 0 ]
then
echo "Error occurred while calling sqlplus "
exit 2
fi
}
# Check for the Valid inputs
if [ "$1" = "" ] ; then
echo "ERROR: Invalid Input parameter"
echo "Usage: npdbstartstop.sh start/stop"
return
fi
# To set the Oracle variable, run the .profile
#su - ora10g
# Set the DB Conf details
echo "Set the ORACLE configurations"
. /software/np/db/scripts/dbenv.conf
echo $ORACLE_SID
if [ "$1" = "stop" ] ; then
echo "****** SHUTDOWN OPTION IS SELECTED... Connecting to DB..."
echo "****** SHUTDOWN OPTION SELECTED... ORACLE IS GOING DOWN IMMEDIATELY *********"
call_sql_plus
connect /as sysdba
shutdown immediate
---------------------------------------------------
all the oracle related env variables are set, including ORACLE_SID.
The problem with the above script is, it is getting into the sqlplus prompt and connecting as sysdba. But 'shutdown immediate' is not recognising as proper db shutdown command.
It is taking it as unix machine shutdown command.
Pls post ur valuable suggestions, how can i execute the above shell script in sqlplus context?
With Warm Regards,
Krishna