How to delete a database in Oracle?
To delete an Oracle database, follow these steps:
- Firstly, make sure you have the permission to delete the database. If you are an administrator user or a user with SYSDBA privileges, you can proceed to the next step.
- Login to the database as SYSDBA using the following command in the command line or terminal:
sqlplus / as sysdba
- Run the following command to shut down the database:
shutdown immediate
- Make sure the database is closed before logging in to the database again with the SYSDBA identity.
- Execute the following command to delete the database:
startup mount exclusive restrict;
drop database;
exit;
- After deleting the database, you can close SQL*Plus.
Please be sure to backup important data before deleting the database. Deleting the database is an irreversible operation and data cannot be recovered once deleted.