Stay at Home!! Be Safe!! Take Care!!

Thanks all my viewers for your support, I am an Oracle Ace now. For Any queries, please mail us at support@funoracleapps.com

Shell script to DROP an Oracle Database

No comments

Shell script to DROP an Oracle Database


Many times when cloning a database we might need to drop the previous database and recreate it using the clone. For this, I am sharing a simple shell script to drop the database easily. You can change the code as per your requirement and customize it.



Note: Using the script is totally at your discretion, or you can use individual steps to drop the database manually. Do not use if you are not sure about Oracle database drop.


cat drop_database.sh

echo "Sourcing the environment"
. .bash_profile
echo "Check the Database Name $ORACLE_SID"
echo "ctrl + c to cancel this script"
sleep 30
sqlplus /nolog <<  EOF
connect / as sysdba
shutdown abort
startup mount exclusive
alter system enable restricted session;
exit
EOF
rman target / <<EOF
drop database NOPROMPT;
exit
EOF
lsnrctl stop $ORACLE_SID
lsnrctl start $ORACLE_SID



If you like please follow and comment

No comments :

Post a Comment