Site icon IT Tutorial

How to Drop Database in Oracle Database 19c

Hi,

Sometimes you may need to drop Oracle database especially in test or development databases.

 

Mostly test or development databases are expired when testing or development is done. And When these databases are not used, we should drop this database with following steps.

 

You cannot drop Oracle database when it is open. You will get following error if you try this.

 

 

[oracle@MehmetSalih ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Mar 26 07:13:04 2019
Version 19.2.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0

SQL> drop database;
drop database
*
ERROR at line 1:
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

 

You should shutdown database and open it mount exclusive mode.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>

SQL> startup mount restrict
ORACLE instance started.

Total System Global Area 1140849896 bytes
Fixed Size 8895720 bytes
Variable Size 838860800 bytes
Database Buffers 285212672 bytes
Redo Buffers 7880704 bytes
Database mounted.
SQL>

 

 

 

Then you can drop database like following.

 

SQL> drop database;

Database dropped.

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0
SQL>
SQL> exit
[oracle@MehmetSalih ~]$

 

You can see that Oracle database 19c is dropped.

 

[oracle@MehmetSalih ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Mar 26 07:19:54 2019
Version 19.2.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Connected to an idle instance.

SQL> 


 

 

You can read the following post to learn How To Create A Database Manually and How to Create a Database Using DBCA Silent Mode in Oracle

https://ittutorial.org/how-to-create-a-database-manually-and-how-to-create-a-database-using-dbca-silent-mode-in-oracle/

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

https://ittutorial.org/oracle-database-19c-tutorials-for-beginners/

Exit mobile version