#! /usr/bin/ksh

# @version $Id: removeWFS_DW.ksh,v 1.1 2007/10/29 19:39:26 dweiner Exp $

typeset database_name
typeset confirm

clear
print ""
print "\t Tandberg Television WatchPoint Database Removal Wizard"
print "\t=======================================================\n"
read database_name?"    Choose the name of the WatchPoint Data Warehouse you would like to delete.  The database is default is [${ORACLE_SID}] "

if [[ -z $database_name ]]
then
  database_name=${ORACLE_SID}
fi


print " "
read confirm?"    You are about to delete the ${database_name} database!!! Are you sure you wish to continue? [Yes/No] "

if [ ${confirm} = "Yes" ]
 then
  print " "
  print "    Dropping the ${database_name} database..."

export ORACLE_SID=$database_name

sqlplus -s /nolog  << EOF
   connect / as sysdba
   shutdown abort
   exit
EOF

rm -rf /home/oracle/admin/${database_name}
rm -rf /oradata/${database_name}
rm -rf /oradata1/${database_name}
rm -rf /oradata2/${database_name}
rm -rf /oradata3/${database_name}
rm -rf /oradata4/${database_name}
rm -rf /oradata5/${database_name}arch
rm -rf /oradata5/recovery/${database_name}
rm -rf /usr/local/n2bb/backup/${database_name}
rm -rf $ORACLE_HOME/dbs/init${database_name}.ora
rm -rf $ORACLE_HOME/dbs/orapw${database_name}
rm -rf $ORACLE_HOME/rdbms/audit/${database_name}
rm /usr/local/n2bb/backup/scripts/crontab

elif [ ${confirm} = "No" ]
 then
  print " "
  print "    Database delete stopped due to user abort."
  print " "

elif [[ -z $confirm ]]
 then
  print " "
  print "    Database delete stopped due to missing confirmation."
  print " "

else
  print " "
  print "    Database delete stopped due to invalid confirmation."
  print " " 

fi

exit 0
