Oracle Tip: Dropping a Database



Here is how to drop a database in Oracle.

Make sure that have ORACLE_SID set first.

Log into sqlplus with sysdba privileges:

sqlplus /nolog
connect / as sysdba

Run the following commands in sqlplus:

shutdown immediate
startup restrict mount exclusive

Before you complete the drop, verify that you are in the correct database — the one that you want to drop (thanks to Dan Norris’ comment):

select * from v$database;

Now you can drop the database.

drop database;

Share

2 Comments

  1. Dan Norris says:

    I think I might include a “select * from v$database;” just before that “drop database;” statement. :)

  2. digitaleagle says:

    That is a great point. Thanks for the suggestion.

Leave a comment