Steps to drop a standalone oracle database
Prerequisite Steps
Find the location of the data files ,control files and online redo logs of the database to be dropped. Later point , we will cross verify , if those files are removed or not.
Following commands can be used to store the details of the same.
SQL> select name from v$datafile;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;
Step 1 : Connect to the database with sysdba privilege
$ export ORACLE_SID=orcldb
$ sqlplus "/ as sysdba"
Step 2 : Shutdown the database
SQL> shutdown immediate;
Step 3: Start the Database in Exclusive mode
SQL> startup mount exclusive restrict;
Step 4: Drop the database
SQL> drop database;
Step 5 : Post verification
1) Cross verify if all the associated datafiles, comntrolfile and online redologs are removed
2) Remove the directories if not required
3) Remove the entry of the database from /etc/oratab
4) Modify/drop any of the scripts used for this database
Steps for dropping database in Oracle RAC.
1. Make cluster database to FALSE
SQL> alter system set cluster_database=FALSE scope=spfile sid='*';
System altered.
2. Stop the db service
Srvctl stop database –d ORADB
3. start the database in mount exclusive mode:
SQL> startup mount exclusive restrict;
SQL> select instance_name,status,logins from v$Instance;
4.Now drop the database:
SQL> drop database;
Database dropped.
5. Remove the db service from cluster
srvctl remove database -db ORADB
Enjoy the work and do like me if you like this article!!!