There are multiple options available for dropping an Oracle database. We can use DBCA/CLI/Manual deletion process for dropping the database. In this post i will show how we can drop the database from the SQL prompt.
I would recommend to perform a database backup if in case it contains any transaction Data (TEST/DEV/UAT/PROD). Once we drop the database its very difficult to recover it back if we do not have any backup policy in place.
To drop the database we must open the database in restricted mode else it will not allow to drop database.
– Lets try to drop database in mount state:
SQL> startup mount ORACLE instance started. Total System Global Area 6442450944 bytes Fixed Size 5287720 bytes Variable Size 1442844888 bytes Database Buffers 4982833152 bytes Redo Buffers 11485184 bytes Database mounted. SQL> drop database; drop database * ERROR at line 1:ORA-12719: operation requires database is in RESTRICTED mode
– Shutdown database and startup again in the restricted mode to DROP
SQL> startup mount restrict ORACLE instance started. Total System Global Area 6442450944 bytes Fixed Size 5287720 bytes Variable Size 1442844888 bytes Database Buffers 4982833152 bytes Redo Buffers 11485184 bytes Database mounted. SQL> drop database;Database dropped. Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL>
- Drop database command will delete Datafiles, Controlfiles, online redologfiles, Spfile
- Drop database command will not delete init.ora file, password files, listener.ora file and it will also not remove entries from the oratab files.