How to delete a database
14/04/2018 Leave a comment
In this post, I take an interesting topic and nothing complicated of how to erase a single Oracle database. This affects only the database, nohing happens to the RDBMS binary files.
The first thing to do is to get down the database’s instance to avoid someone connected to it, to do this, you have issue the option immediate of the shutdown command:
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.
Once the database’s instance is down, you must mount the database with the option exclusive restrict to avoid new user connections:
SQL> startup mount exclusive restrict ORACLE instance started. Total System Global Area 665415680 bytes Fixed Size 1385564 bytes Variable Size 448793508 bytes Database Buffers 209715200 bytes Redo Buffers 5521408 bytes Database mounted.
Then, after the database is mounted, the only thing else that you must do is to issue the drop database as you can see in the next example:
SQL> drop database; ERROR: ORA-01034: ORACLE not available Process identifier: 2676 Session identifier: 1 Serial number: 5 Database dropped. Disconnected from Oracle Database 11g Release 11.2.0.2.0 - Production
So after the database will complete erased. Be careful with this command because you will have just a previous backup to recover from it.
Please, leave a comment if this post was useful for you or if you have any doubt about the contents, I will OrAnswer you as soon as possible.